1
1
package coderd_test
2
2
3
3
import (
4
- "context"
5
4
"net/http"
6
5
"testing"
7
6
@@ -16,9 +15,7 @@ func TestMultiOrgFetch(t *testing.T) {
16
15
t .Parallel ()
17
16
client := coderdtest .New (t , nil )
18
17
_ = coderdtest .CreateFirstUser (t , client )
19
-
20
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
21
- defer cancel ()
18
+ ctx := testutil .Context (t , testutil .WaitLong )
22
19
23
20
makeOrgs := []string {"foo" , "bar" , "baz" }
24
21
for _ , name := range makeOrgs {
@@ -38,9 +35,7 @@ func TestOrganizationsByUser(t *testing.T) {
38
35
t .Parallel ()
39
36
client := coderdtest .New (t , nil )
40
37
_ = coderdtest .CreateFirstUser (t , client )
41
-
42
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
43
- defer cancel ()
38
+ ctx := testutil .Context (t , testutil .WaitLong )
44
39
45
40
orgs , err := client .OrganizationsByUser (ctx , codersdk .Me )
46
41
require .NoError (t , err )
@@ -62,9 +57,7 @@ func TestOrganizationByUserAndName(t *testing.T) {
62
57
t .Parallel ()
63
58
client := coderdtest .New (t , nil )
64
59
coderdtest .CreateFirstUser (t , client )
65
-
66
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
67
- defer cancel ()
60
+ ctx := testutil .Context (t , testutil .WaitLong )
68
61
69
62
_ , err := client .OrganizationByUserAndName (ctx , codersdk .Me , "nothing" )
70
63
var apiErr * codersdk.Error
@@ -77,9 +70,7 @@ func TestOrganizationByUserAndName(t *testing.T) {
77
70
client := coderdtest .New (t , nil )
78
71
first := coderdtest .CreateFirstUser (t , client )
79
72
other , _ := coderdtest .CreateAnotherUser (t , client , first .OrganizationID )
80
-
81
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
82
- defer cancel ()
73
+ ctx := testutil .Context (t , testutil .WaitLong )
83
74
84
75
org , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
85
76
Name : "another" ,
@@ -95,9 +86,7 @@ func TestOrganizationByUserAndName(t *testing.T) {
95
86
t .Parallel ()
96
87
client := coderdtest .New (t , nil )
97
88
user := coderdtest .CreateFirstUser (t , client )
98
-
99
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
100
- defer cancel ()
89
+ ctx := testutil .Context (t , testutil .WaitLong )
101
90
102
91
org , err := client .Organization (ctx , user .OrganizationID )
103
92
require .NoError (t , err )
@@ -112,9 +101,7 @@ func TestPostOrganizationsByUser(t *testing.T) {
112
101
t .Parallel ()
113
102
client := coderdtest .New (t , nil )
114
103
user := coderdtest .CreateFirstUser (t , client )
115
-
116
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
117
- defer cancel ()
104
+ ctx := testutil .Context (t , testutil .WaitLong )
118
105
119
106
org , err := client .Organization (ctx , user .OrganizationID )
120
107
require .NoError (t , err )
@@ -130,9 +117,7 @@ func TestPostOrganizationsByUser(t *testing.T) {
130
117
t .Parallel ()
131
118
client := coderdtest .New (t , nil )
132
119
_ = coderdtest .CreateFirstUser (t , client )
133
-
134
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
135
- defer cancel ()
120
+ ctx := testutil .Context (t , testutil .WaitLong )
136
121
137
122
_ , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
138
123
Name : "new" ,
@@ -147,9 +132,7 @@ func TestPatchOrganizationsByUser(t *testing.T) {
147
132
t .Parallel ()
148
133
client := coderdtest .New (t , nil )
149
134
user := coderdtest .CreateFirstUser (t , client )
150
-
151
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
152
- defer cancel ()
135
+ ctx := testutil .Context (t , testutil .WaitMedium )
153
136
154
137
originalOrg , err := client .Organization (ctx , user .OrganizationID )
155
138
require .NoError (t , err )
@@ -170,9 +153,7 @@ func TestPatchOrganizationsByUser(t *testing.T) {
170
153
t .Parallel ()
171
154
client := coderdtest .New (t , nil )
172
155
_ = coderdtest .CreateFirstUser (t , client )
173
-
174
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
175
- defer cancel ()
156
+ ctx := testutil .Context (t , testutil .WaitMedium )
176
157
177
158
o , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
178
159
Name : "something-unique" ,
@@ -191,9 +172,7 @@ func TestPatchOrganizationsByUser(t *testing.T) {
191
172
t .Parallel ()
192
173
client := coderdtest .New (t , nil )
193
174
_ = coderdtest .CreateFirstUser (t , client )
194
-
195
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
196
- defer cancel ()
175
+ ctx := testutil .Context (t , testutil .WaitMedium )
197
176
198
177
o , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
199
178
Name : "new" ,
@@ -211,9 +190,7 @@ func TestPatchOrganizationsByUser(t *testing.T) {
211
190
t .Parallel ()
212
191
client := coderdtest .New (t , nil )
213
192
_ = coderdtest .CreateFirstUser (t , client )
214
-
215
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
216
- defer cancel ()
193
+ ctx := testutil .Context (t , testutil .WaitMedium )
217
194
218
195
o , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
219
196
Name : "new" ,
@@ -234,9 +211,7 @@ func TestDeleteOrganizationsByUser(t *testing.T) {
234
211
t .Parallel ()
235
212
client := coderdtest .New (t , nil )
236
213
user := coderdtest .CreateFirstUser (t , client )
237
-
238
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
239
- defer cancel ()
214
+ ctx := testutil .Context (t , testutil .WaitMedium )
240
215
241
216
o , err := client .Organization (ctx , user .OrganizationID )
242
217
require .NoError (t , err )
@@ -251,9 +226,7 @@ func TestDeleteOrganizationsByUser(t *testing.T) {
251
226
t .Parallel ()
252
227
client := coderdtest .New (t , nil )
253
228
_ = coderdtest .CreateFirstUser (t , client )
254
-
255
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
256
- defer cancel ()
229
+ ctx := testutil .Context (t , testutil .WaitMedium )
257
230
258
231
o , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
259
232
Name : "doomed" ,
@@ -268,9 +241,7 @@ func TestDeleteOrganizationsByUser(t *testing.T) {
268
241
t .Parallel ()
269
242
client := coderdtest .New (t , nil )
270
243
_ = coderdtest .CreateFirstUser (t , client )
271
-
272
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
273
- defer cancel ()
244
+ ctx := testutil .Context (t , testutil .WaitMedium )
274
245
275
246
o , err := client .CreateOrganization (ctx , codersdk.CreateOrganizationRequest {
276
247
Name : "doomed" ,
0 commit comments