Skip to content

Commit 046fd87

Browse files
authored
Merge pull request #588 from jetstack/VC-36593-extra-unit-test
VC-36593: Tests: Make sure --venafi-cloud can be used along with --client-id
2 parents e849db2 + fdc4404 commit 046fd87

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

pkg/agent/config_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,23 @@ func Test_ValidateAndCombineConfig(t *testing.T) {
306306
assert.IsType(t, &client.VenafiCloudClient{}, cl)
307307
})
308308

309+
t.Run("venafi-cloud-keypair-auth: it is possible to use --client-id with --venafi-cloud", func(t *testing.T) {
310+
privKeyPath := withFile(t, fakePrivKeyPEM)
311+
got, cl, err := ValidateAndCombineConfig(discardLogs(),
312+
withConfig(testutil.Undent(`
313+
server: "http://localhost:8080"
314+
period: 1h
315+
cluster_id: "the cluster name"
316+
venafi-cloud:
317+
upload_path: "/foo/bar"
318+
`)),
319+
withCmdLineFlags("--client-id", "5bc7d07c-45da-11ef-a878-523f1e1d7de1", "--private-key-path", privKeyPath, "--venafi-cloud"),
320+
)
321+
require.NoError(t, err)
322+
assert.Equal(t, VenafiCloudKeypair, got.AuthMode)
323+
assert.IsType(t, &client.VenafiCloudClient{}, cl)
324+
})
325+
309326
t.Run("jetstack-secure-oauth-auth: fail if organization_id or cluster_id is missing and --venafi-cloud not enabled", func(t *testing.T) {
310327
t.Setenv("POD_NAMESPACE", "venafi")
311328
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"}`)

0 commit comments

Comments
 (0)