@@ -92,28 +92,77 @@ func TestScaleTestWorkspaceTraffic(t *testing.T) {
92
92
// This test just validates that the CLI command accepts its known arguments.
93
93
func TestScaleTestDashboard (t * testing.T ) {
94
94
t .Parallel ()
95
- ctx , cancelFunc := context .WithTimeout (context .Background (), testutil .WaitMedium )
96
- defer cancelFunc ()
97
-
98
- log := slogtest .Make (t , & slogtest.Options {IgnoreErrors : true })
99
- client := coderdtest .New (t , & coderdtest.Options {
100
- Logger : & log ,
95
+ t .Run ("MinWait" , func (t * testing.T ) {
96
+ t .Parallel ()
97
+ ctx , cancelFunc := context .WithTimeout (context .Background (), testutil .WaitShort )
98
+ defer cancelFunc ()
99
+
100
+ log := slogtest .Make (t , & slogtest.Options {IgnoreErrors : true })
101
+ client := coderdtest .New (t , & coderdtest.Options {
102
+ Logger : & log ,
103
+ })
104
+ _ = coderdtest .CreateFirstUser (t , client )
105
+
106
+ inv , root := clitest .New (t , "exp" , "scaletest" , "dashboard" ,
107
+ "--min-wait" , "0s" ,
108
+ )
109
+ clitest .SetupConfig (t , client , root )
110
+ pty := ptytest .New (t )
111
+ inv .Stdout = pty .Output ()
112
+ inv .Stderr = pty .Output ()
113
+
114
+ err := inv .WithContext (ctx ).Run ()
115
+ require .ErrorContains (t , err , "--min-wait must be greater than zero" )
101
116
})
102
- _ = coderdtest .CreateFirstUser (t , client )
103
117
104
- inv , root := clitest .New (t , "exp" , "scaletest" , "dashboard" ,
105
- "--count" , "1" ,
106
- "--min-wait" , "100ms" ,
107
- "--max-wait" , "1s" ,
108
- "--timeout" , "5s" ,
109
- "--scaletest-prometheus-address" , "127.0.0.1:0" ,
110
- "--scaletest-prometheus-wait" , "0s" ,
111
- )
112
- clitest .SetupConfig (t , client , root )
113
- pty := ptytest .New (t )
114
- inv .Stdout = pty .Output ()
115
- inv .Stderr = pty .Output ()
118
+ t .Run ("MaxWait" , func (t * testing.T ) {
119
+ t .Parallel ()
120
+ ctx , cancelFunc := context .WithTimeout (context .Background (), testutil .WaitShort )
121
+ defer cancelFunc ()
122
+
123
+ log := slogtest .Make (t , & slogtest.Options {IgnoreErrors : true })
124
+ client := coderdtest .New (t , & coderdtest.Options {
125
+ Logger : & log ,
126
+ })
127
+ _ = coderdtest .CreateFirstUser (t , client )
128
+
129
+ inv , root := clitest .New (t , "exp" , "scaletest" , "dashboard" ,
130
+ "--min-wait" , "0s" ,
131
+ )
132
+ clitest .SetupConfig (t , client , root )
133
+ pty := ptytest .New (t )
134
+ inv .Stdout = pty .Output ()
135
+ inv .Stderr = pty .Output ()
136
+
137
+ err := inv .WithContext (ctx ).Run ()
138
+ require .ErrorContains (t , err , "--max-wait must be greater than --min-wait" )
139
+ })
116
140
117
- err := inv .WithContext (ctx ).Run ()
118
- require .NoError (t , err , "" )
141
+ t .Run ("OK" , func (t * testing.T ) {
142
+ t .Parallel ()
143
+ ctx , cancelFunc := context .WithTimeout (context .Background (), testutil .WaitMedium )
144
+ defer cancelFunc ()
145
+
146
+ log := slogtest .Make (t , & slogtest.Options {IgnoreErrors : true })
147
+ client := coderdtest .New (t , & coderdtest.Options {
148
+ Logger : & log ,
149
+ })
150
+ _ = coderdtest .CreateFirstUser (t , client )
151
+
152
+ inv , root := clitest .New (t , "exp" , "scaletest" , "dashboard" ,
153
+ "--count" , "1" ,
154
+ "--min-wait" , "100ms" ,
155
+ "--max-wait" , "1s" ,
156
+ "--timeout" , "5s" ,
157
+ "--scaletest-prometheus-address" , "127.0.0.1:0" ,
158
+ "--scaletest-prometheus-wait" , "0s" ,
159
+ )
160
+ clitest .SetupConfig (t , client , root )
161
+ pty := ptytest .New (t )
162
+ inv .Stdout = pty .Output ()
163
+ inv .Stderr = pty .Output ()
164
+
165
+ err := inv .WithContext (ctx ).Run ()
166
+ require .NoError (t , err , "" )
167
+ })
119
168
}
0 commit comments