Skip to content

Commit 27d6654

Browse files
UnwashedMemevalyria257
authored andcommitted
test: fix grpc mTLS dialoptions test
This was incorrectly passing in the cert and key backwards which resulted in not actually getting mTLS credentials, but instead insecure credentials. When insecure credentials are used, skipToken means we don't add a addPerRPCCredentials. When it is a secure TLS credential then addPerRPCCredentials increases the dialoption count by one.
1 parent 972b498 commit 27d6654

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/grpc/grpc_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func Test_GetDialOptions(t *testing.T) {
103103
{
104104
name: "Test 2: DialOptions mTLS",
105105
agentConfig: types.AgentConfig(),
106-
expected: 7,
106+
expected: 8,
107107
createCerts: true,
108108
},
109109
{
@@ -171,8 +171,8 @@ func Test_GetDialOptions(t *testing.T) {
171171
key, cert := helpers.GenerateSelfSignedCert(t)
172172
_, ca := helpers.GenerateSelfSignedCert(t)
173173

174-
keyContents := helpers.Cert{Name: keyFileName, Type: certificateType, Contents: key}
175-
certContents := helpers.Cert{Name: certFileName, Type: privateKeyType, Contents: cert}
174+
keyContents := helpers.Cert{Name: keyFileName, Type: privateKeyType, Contents: key}
175+
certContents := helpers.Cert{Name: certFileName, Type: certificateType, Contents: cert}
176176
caContents := helpers.Cert{Name: caFileName, Type: certificateType, Contents: ca}
177177

178178
helpers.WriteCertFiles(t, tmpDir, keyContents)

0 commit comments

Comments
 (0)