Skip to content

Commit

Permalink
tests: make sure --venafi-cloud can be used along with --client-id
Browse files Browse the repository at this point in the history
  • Loading branch information
maelvls committed Oct 7, 2024
1 parent 545b0ab commit fdc4404
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pkg/agent/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,23 @@ func Test_ValidateAndCombineConfig(t *testing.T) {
assert.IsType(t, &client.VenafiCloudClient{}, cl)
})

t.Run("venafi-cloud-keypair-auth: it is possible to use --client-id with --venafi-cloud", func(t *testing.T) {
privKeyPath := withFile(t, fakePrivKeyPEM)
got, cl, err := ValidateAndCombineConfig(discardLogs(),
withConfig(testutil.Undent(`
server: "http://localhost:8080"
period: 1h
cluster_id: "the cluster name"
venafi-cloud:
upload_path: "/foo/bar"
`)),
withCmdLineFlags("--client-id", "5bc7d07c-45da-11ef-a878-523f1e1d7de1", "--private-key-path", privKeyPath, "--venafi-cloud"),
)
require.NoError(t, err)
assert.Equal(t, VenafiCloudKeypair, got.AuthMode)
assert.IsType(t, &client.VenafiCloudClient{}, cl)
})

t.Run("jetstack-secure-oauth-auth: fail if organization_id or cluster_id is missing and --venafi-cloud not enabled", func(t *testing.T) {
credsPath := withFile(t, `{"user_id":"fpp2624799349@affectionate-hertz6.platform.jetstack.io","user_secret":"foo","client_id": "k3TrDbfLhCgnpAbOiiT2kIE1AbovKzjo","client_secret": "f39w_3KT9Vp0VhzcPzvh-uVbudzqCFmHER3Huj0dvHgJwVrjxsoOQPIw_1SDiCfa","auth_server_domain":"auth.jetstack.io"}`)
_, _, err := ValidateAndCombineConfig(discardLogs(), withConfig(""), withCmdLineFlags("--credentials-file", credsPath))
Expand Down

0 comments on commit fdc4404

Please sign in to comment.