@@ -3,7 +3,6 @@ package coderd_test
3
3
import (
4
4
"context"
5
5
"testing"
6
- "time"
7
6
8
7
"github.com/stretchr/testify/require"
9
8
@@ -13,38 +12,63 @@ import (
13
12
"github.com/coder/coder/coderd/coderdtest"
14
13
"github.com/coder/coder/coderd/database/dbtestutil"
15
14
"github.com/coder/coder/enterprise/coderd/coderdenttest"
15
+ "github.com/coder/coder/testutil"
16
16
)
17
17
18
18
func TestReplicas (t * testing.T ) {
19
19
t .Parallel ()
20
- db , pubsub := dbtestutil .NewDB (t )
21
- firstClient := coderdenttest .New (t , & coderdenttest.Options {
22
- Options : & coderdtest.Options {
23
- IncludeProvisionerDaemon : true ,
24
- Database : db ,
25
- Pubsub : pubsub ,
26
- },
20
+ t .Run ("WarningsWithoutLicense" , func (t * testing.T ) {
21
+ t .Parallel ()
22
+ db , pubsub := dbtestutil .NewDB (t )
23
+ firstClient := coderdenttest .New (t , & coderdenttest.Options {
24
+ Options : & coderdtest.Options {
25
+ IncludeProvisionerDaemon : true ,
26
+ Database : db ,
27
+ Pubsub : pubsub ,
28
+ },
29
+ })
30
+ _ = coderdtest .CreateFirstUser (t , firstClient )
31
+ secondClient := coderdenttest .New (t , & coderdenttest.Options {
32
+ Options : & coderdtest.Options {
33
+ Database : db ,
34
+ Pubsub : pubsub ,
35
+ },
36
+ })
37
+ secondClient .SessionToken = firstClient .SessionToken
38
+ ents , err := secondClient .Entitlements (context .Background ())
39
+ require .NoError (t , err )
40
+ require .Len (t , ents .Warnings , 1 )
27
41
})
28
- firstUser := coderdtest .CreateFirstUser (t , firstClient )
29
- coderdenttest .AddLicense (t , firstClient , coderdenttest.LicenseOptions {
30
- HighAvailability : true ,
31
- })
32
-
33
- secondClient := coderdenttest .New (t , & coderdenttest.Options {
34
- Options : & coderdtest.Options {
35
- Database : db ,
36
- Pubsub : pubsub ,
37
- },
38
- })
39
- secondClient .SessionToken = firstClient .SessionToken
42
+ t .Run ("ConnectAcrossMultiple" , func (t * testing.T ) {
43
+ t .Parallel ()
44
+ db , pubsub := dbtestutil .NewDB (t )
45
+ firstClient := coderdenttest .New (t , & coderdenttest.Options {
46
+ Options : & coderdtest.Options {
47
+ IncludeProvisionerDaemon : true ,
48
+ Database : db ,
49
+ Pubsub : pubsub ,
50
+ },
51
+ })
52
+ firstUser := coderdtest .CreateFirstUser (t , firstClient )
53
+ coderdenttest .AddLicense (t , firstClient , coderdenttest.LicenseOptions {
54
+ HighAvailability : true ,
55
+ })
40
56
41
- agentID := setupWorkspaceAgent (t , firstClient , firstUser )
42
- conn , err := secondClient . DialWorkspaceAgentTailnet ( context . Background (), slogtest . Make ( t , nil ). Leveled ( slog . LevelDebug ), agentID )
43
- require . NoError ( t , err )
44
- require . Eventually ( t , func () bool {
45
- _ , err = conn . Ping ()
46
- return err == nil
47
- }, 10 * time . Second , 250 * time . Millisecond )
57
+ secondClient := coderdenttest . New (t , & coderdenttest. Options {
58
+ Options : & coderdtest. Options {
59
+ Database : db ,
60
+ Pubsub : pubsub ,
61
+ },
62
+ })
63
+ secondClient . SessionToken = firstClient . SessionToken
48
64
49
- _ = conn .Close ()
65
+ agentID := setupWorkspaceAgent (t , firstClient , firstUser )
66
+ conn , err := secondClient .DialWorkspaceAgentTailnet (context .Background (), slogtest .Make (t , nil ).Leveled (slog .LevelDebug ), agentID )
67
+ require .NoError (t , err )
68
+ require .Eventually (t , func () bool {
69
+ _ , err = conn .Ping ()
70
+ return err == nil
71
+ }, testutil .WaitShort , testutil .IntervalFast )
72
+ _ = conn .Close ()
73
+ })
50
74
}
0 commit comments