Skip to content

Git: Add test for http bearer token auth #1005

Open

Description

@darkowlzz

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.

Activity

  1. added
    area/gitGit related issues and pull requests
    area/testingTesting related issues and pull requests
    on Jan 25, 2023
  2. Santosh1176 commented on Mar 5, 2023

    @Santosh1176

    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$ 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/gitGit related issues and pull requestsarea/testingTesting related issues and pull requestsgood first issueGood for newcomers

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions