Skip to content

Commit 6e34de6

Browse files
committed
Make tests more resilient across platforms
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent 01d4f2f commit 6e34de6

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

coderd/notifications/dispatch/smtp_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func TestSMTP(t *testing.T) {
217217
// TLS is forced but certificate used by mock server is untrusted.
218218
name: "TLS: x509 untrusted",
219219
useTLS: true,
220-
expectedErr: "certificate is not trusted",
220+
expectedErr: "tls: failed to verify certificate",
221221
retryable: true,
222222
},
223223
{
@@ -260,7 +260,7 @@ func TestSMTP(t *testing.T) {
260260
},
261261
ForceTLS: false,
262262
},
263-
expectedErr: "certificate is not trusted",
263+
expectedErr: "tls: failed to verify certificate",
264264
retryable: true,
265265
},
266266
{
@@ -317,7 +317,10 @@ func TestSMTP(t *testing.T) {
317317
CAFile: "nope.crt",
318318
},
319319
},
320-
expectedErr: "open nope.crt: no such file or directory",
320+
// not using full error message here since it differs on *nix and Windows:
321+
// *nix: no such file or directory
322+
// Windows: The system cannot find the file specified.
323+
expectedErr: "open nope.crt:",
321324
retryable: true,
322325
},
323326
{
@@ -330,7 +333,10 @@ func TestSMTP(t *testing.T) {
330333
KeyFile: keyFile,
331334
},
332335
},
333-
expectedErr: "open fixtures/nope.cert: no such file or directory",
336+
// not using full error message here since it differs on *nix and Windows:
337+
// *nix: no such file or directory
338+
// Windows: The system cannot find the file specified.
339+
expectedErr: "open fixtures/nope.cert:",
334340
retryable: true,
335341
},
336342
{
@@ -343,7 +349,10 @@ func TestSMTP(t *testing.T) {
343349
KeyFile: "fixtures/nope.key",
344350
},
345351
},
346-
expectedErr: "open fixtures/nope.key: no such file or directory",
352+
// not using full error message here since it differs on *nix and Windows:
353+
// *nix: no such file or directory
354+
// Windows: The system cannot find the file specified.
355+
expectedErr: "open fixtures/nope.key:",
347356
retryable: true,
348357
},
349358
/**

0 commit comments

Comments
 (0)