@@ -19,7 +19,7 @@ import (
19
19
"github.com/coder/serpent"
20
20
21
21
"github.com/coder/coder/v2/coderd/notifications/dispatch"
22
- "github.com/coder/coder/v2/coderd/notifications/dispatch/mocksmtp "
22
+ "github.com/coder/coder/v2/coderd/notifications/dispatch/smtptest "
23
23
"github.com/coder/coder/v2/coderd/notifications/types"
24
24
"github.com/coder/coder/v2/codersdk"
25
25
"github.com/coder/coder/v2/testutil"
@@ -45,9 +45,9 @@ func TestSMTP(t *testing.T) {
45
45
subject = "This is the subject"
46
46
body = "This is the body"
47
47
48
- caFile = "mocksmtp /fixtures/ca.crt"
49
- certFile = "mocksmtp /fixtures/server.crt"
50
- keyFile = "mocksmtp /fixtures/server.key"
48
+ caFile = "smtptest /fixtures/ca.crt"
49
+ certFile = "smtptest /fixtures/server.crt"
50
+ keyFile = "smtptest /fixtures/server.key"
51
51
)
52
52
53
53
logger := slogtest .Make (t , & slogtest.Options {IgnoreErrors : true , IgnoredErrorIs : []error {}}).Leveled (slog .LevelDebug )
@@ -123,7 +123,7 @@ func TestSMTP(t *testing.T) {
123
123
124
124
Auth : codersdk.NotificationsEmailAuthConfig {
125
125
Username : username ,
126
- PasswordFile : "mocksmtp /fixtures/password.txt" ,
126
+ PasswordFile : "smtptest /fixtures/password.txt" ,
127
127
},
128
128
},
129
129
toAddrs : []string {to },
@@ -339,14 +339,14 @@ func TestSMTP(t *testing.T) {
339
339
cfg : codersdk.NotificationsEmailConfig {
340
340
TLS : codersdk.NotificationsEmailTLSConfig {
341
341
CAFile : caFile ,
342
- CertFile : "mocksmtp /fixtures/nope.cert" ,
342
+ CertFile : "smtptest /fixtures/nope.cert" ,
343
343
KeyFile : keyFile ,
344
344
},
345
345
},
346
346
// not using full error message here since it differs on *nix and Windows:
347
347
// *nix: no such file or directory
348
348
// Windows: The system cannot find the file specified.
349
- expectedErr : "open mocksmtp /fixtures/nope.cert:" ,
349
+ expectedErr : "open smtptest /fixtures/nope.cert:" ,
350
350
retryable : true ,
351
351
},
352
352
{
@@ -356,13 +356,13 @@ func TestSMTP(t *testing.T) {
356
356
TLS : codersdk.NotificationsEmailTLSConfig {
357
357
CAFile : caFile ,
358
358
CertFile : certFile ,
359
- KeyFile : "mocksmtp /fixtures/nope.key" ,
359
+ KeyFile : "smtptest /fixtures/nope.key" ,
360
360
},
361
361
},
362
362
// not using full error message here since it differs on *nix and Windows:
363
363
// *nix: no such file or directory
364
364
// Windows: The system cannot find the file specified.
365
- expectedErr : "open mocksmtp /fixtures/nope.key:" ,
365
+ expectedErr : "open smtptest /fixtures/nope.key:" ,
366
366
retryable : true ,
367
367
},
368
368
/**
@@ -415,7 +415,7 @@ func TestSMTP(t *testing.T) {
415
415
416
416
tc .cfg .ForceTLS = serpent .Bool (tc .useTLS )
417
417
418
- backend := mocksmtp .NewBackend (mocksmtp .Config {
418
+ backend := smtptest .NewBackend (smtptest .Config {
419
419
AuthMechanisms : tc .authMechs ,
420
420
421
421
AcceptedIdentity : tc .cfg .Auth .Identity .String (),
@@ -426,7 +426,7 @@ func TestSMTP(t *testing.T) {
426
426
})
427
427
428
428
// Create a mock SMTP server which conditionally listens for plain or TLS connections.
429
- srv , listen , err := mocksmtp .CreateMockSMTPServer (backend , tc .useTLS )
429
+ srv , listen , err := smtptest .CreateMockSMTPServer (backend , tc .useTLS )
430
430
require .NoError (t , err )
431
431
t .Cleanup (func () {
432
432
// We expect that the server has already been closed in the test
@@ -458,7 +458,7 @@ func TestSMTP(t *testing.T) {
458
458
459
459
// Wait for the server to become pingable.
460
460
require .Eventually (t , func () bool {
461
- cl , err := mocksmtp .PingClient (listen , tc .useTLS , tc .cfg .TLS .StartTLS .Value ())
461
+ cl , err := smtptest .PingClient (listen , tc .useTLS , tc .cfg .TLS .StartTLS .Value ())
462
462
if err != nil {
463
463
t .Logf ("smtp not yet dialable: %s" , err )
464
464
return false
0 commit comments