Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Git: Add test for http bearer token auth #1005

Open
darkowlzz opened this issue Jan 25, 2023 · 1 comment · May be fixed by #1058
Open

Git: Add test for http bearer token auth #1005

darkowlzz opened this issue Jan 25, 2023 · 1 comment · May be fixed by #1058
Assignees
Labels
area/git Git related issues and pull requests area/testing Testing related issues and pull requests good first issue Good for newcomers

Comments

@darkowlzz
Copy link
Contributor

Add a test case for http bearer token in

// TODO: Add test case for HTTPS with bearer token auth secret. It
// depends on gitkit to have support for bearer token based
// authentication.
once bearer token authentication support is added in gitkit, refer fluxcd/gitkit#11, and gittestserver.

Refer fluxcd/pkg#442 for more discussions around bearer token support.

@darkowlzz darkowlzz added good first issue Good for newcomers area/git Git related issues and pull requests area/testing Testing related issues and pull requests labels Jan 25, 2023
@Santosh1176
Copy link
Contributor

Hey @darkowlzz. Can I take this up?
I was working on this task and the test are passing:

santosh@source-controller:fix-1005$ make test GO_TEST_ARGS="-v -run=TestGitRepositoryReconciler_reconcileSource_authStrategy"
mkdir -p /media/coding/coding/contrib/flux/source-controller/build/testbin
/media/coding/coding/contrib/flux/source-controller/build/gobin/setup-envtest use latest --arch=amd64 --bin-dir=/media/coding/coding/contrib/flux/source-controller/build/testbin
Version: 1.26.1
OS/Arch: linux/amd64
md5: q6yUrWDnTJP88foqTLkatA==
Path: /media/coding/coding/contrib/flux/source-controller/build/testbin/k8s/1.26.1-linux-amd64
chmod -R u+w /media/coding/coding/contrib/flux/source-controller/build/testbin
cd api; go test -v -run=TestGitRepositoryReconciler_reconcileSource_authStrategy ./... -coverprofile cover.out
?       github.com/fluxcd/source-controller/api/v1beta1 [no test files]
testing: warning: no tests to run
PASS
<snip>
<snip>

--- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy (0.99s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/HTTP_without_secretRef_makes_Reconciling=True (0.06s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/HTTP_with_Basic_Auth_secret_makes_Reconciling=True (0.06s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/HTTPS_with_CAFile_secret_makes_Reconciling=True (0.06s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/HTTPS_with_invalid_CAFile_secret_makes_CheckoutFailed=True_and_returns_error (0.03s)
    --> PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/HTTP_with_Bearer_token_secret_makes_Reconciling=True (0.06s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/SSH_with_private_key_secret_makes_Reconciling=True (0.30s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/SSH_with_password_protected_private_key_secret_makes_Reconciling=True (0.34s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/Include_get_failure_makes_CheckoutFailed=True_and_returns_error (0.03s)
    --- PASS: TestGitRepositoryReconciler_reconcileSource_authStrategy/Existing_artifact_makes_ArtifactOutdated=True (0.05s)
PASS
coverage: 4.1% of statements
<snip>
<snip>

coverage: 28.6% of statements
ok      github.com/fluxcd/source-controller/pkg/minio   3.666s  coverage: 28.6% of statements [no tests to run]
santosh@source-controller:fix-1005$ 

@Santosh1176 Santosh1176 linked a pull request Mar 27, 2023 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area/git Git related issues and pull requests area/testing Testing related issues and pull requests good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants