@@ -3,7 +3,6 @@ package reconnectingpty_test
3
3
import (
4
4
"bytes"
5
5
"context"
6
- "runtime"
7
6
"testing"
8
7
"time"
9
8
@@ -23,9 +22,6 @@ import (
23
22
24
23
func Test_Runner (t * testing.T ) {
25
24
t .Parallel ()
26
- if runtime .GOOS != "linux" {
27
- t .Skip ("PTY is flakey on non-Linux platforms" )
28
- }
29
25
30
26
t .Run ("OK" , func (t * testing.T ) {
31
27
t .Parallel ()
@@ -40,7 +36,7 @@ func Test_Runner(t *testing.T) {
40
36
LogOutput : true ,
41
37
})
42
38
43
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
39
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
44
40
defer cancel ()
45
41
46
42
logs := bytes .NewBuffer (nil )
@@ -50,7 +46,9 @@ func Test_Runner(t *testing.T) {
50
46
require .NoError (t , err )
51
47
52
48
require .Contains (t , logStr , "Output:" )
53
- require .Contains (t , logStr , "\t hello world" )
49
+ // OSX: Output:\n\thello world\n
50
+ // Win: Output:\n\t\x1b[2J\x1b[m\x1b[H\x1b]0;Administrator: C:\\Program Files\\PowerShell\\7\\pwsh.exe\a\x1b[?25hhello world\n
51
+ require .Contains (t , logStr , "hello world\n " )
54
52
})
55
53
56
54
t .Run ("NoLogOutput" , func (t * testing.T ) {
@@ -66,7 +64,7 @@ func Test_Runner(t *testing.T) {
66
64
LogOutput : false ,
67
65
})
68
66
69
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
67
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
70
68
defer cancel ()
71
69
72
70
logs := bytes .NewBuffer (nil )
@@ -76,12 +74,10 @@ func Test_Runner(t *testing.T) {
76
74
require .NoError (t , err )
77
75
78
76
require .NotContains (t , logStr , "Output:" )
79
- require .NotContains (t , logStr , "\t hello world" )
80
77
})
81
78
82
79
t .Run ("Timeout" , func (t * testing.T ) {
83
80
t .Parallel ()
84
- t .Skip ("Flaky: https://github.com/coder/coder/issues/5187" )
85
81
86
82
t .Run ("NoTimeout" , func (t * testing.T ) {
87
83
t .Parallel ()
@@ -93,11 +89,11 @@ func Test_Runner(t *testing.T) {
93
89
Init : codersdk.ReconnectingPTYInit {
94
90
Command : "echo 'hello world'" ,
95
91
},
96
- Timeout : httpapi .Duration (5 * time . Second ),
92
+ Timeout : httpapi .Duration (2 * testutil . WaitSuperLong ),
97
93
LogOutput : true ,
98
94
})
99
95
100
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
96
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
101
97
defer cancel ()
102
98
103
99
logs := bytes .NewBuffer (nil )
@@ -115,13 +111,13 @@ func Test_Runner(t *testing.T) {
115
111
runner := reconnectingpty .NewRunner (client , reconnectingpty.Config {
116
112
AgentID : agentID ,
117
113
Init : codersdk.ReconnectingPTYInit {
118
- Command : "sleep 5 " ,
114
+ Command : "sleep 120 " ,
119
115
},
120
116
Timeout : httpapi .Duration (2 * time .Second ),
121
117
LogOutput : true ,
122
118
})
123
119
124
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
120
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
125
121
defer cancel ()
126
122
127
123
logs := bytes .NewBuffer (nil )
@@ -144,14 +140,14 @@ func Test_Runner(t *testing.T) {
144
140
runner := reconnectingpty .NewRunner (client , reconnectingpty.Config {
145
141
AgentID : agentID ,
146
142
Init : codersdk.ReconnectingPTYInit {
147
- Command : "sleep 5 " ,
143
+ Command : "sleep 120 " ,
148
144
},
149
145
Timeout : httpapi .Duration (2 * time .Second ),
150
146
ExpectTimeout : true ,
151
147
LogOutput : true ,
152
148
})
153
149
154
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
150
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
155
151
defer cancel ()
156
152
157
153
logs := bytes .NewBuffer (nil )
@@ -171,12 +167,12 @@ func Test_Runner(t *testing.T) {
171
167
Init : codersdk.ReconnectingPTYInit {
172
168
Command : "echo 'hello world'" ,
173
169
},
174
- Timeout : httpapi .Duration (5 * time . Second ),
170
+ Timeout : httpapi .Duration (2 * testutil . WaitSuperLong ),
175
171
ExpectTimeout : true ,
176
172
LogOutput : true ,
177
173
})
178
174
179
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
175
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
180
176
defer cancel ()
181
177
182
178
logs := bytes .NewBuffer (nil )
@@ -190,7 +186,6 @@ func Test_Runner(t *testing.T) {
190
186
191
187
t .Run ("ExpectOutput" , func (t * testing.T ) {
192
188
t .Parallel ()
193
- t .Skip ("Flaky: https://github.com/coder/coder/issues/5187" )
194
189
195
190
t .Run ("Matches" , func (t * testing.T ) {
196
191
t .Parallel ()
@@ -206,7 +201,7 @@ func Test_Runner(t *testing.T) {
206
201
LogOutput : false ,
207
202
})
208
203
209
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
204
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
210
205
defer cancel ()
211
206
212
207
logs := bytes .NewBuffer (nil )
@@ -230,7 +225,7 @@ func Test_Runner(t *testing.T) {
230
225
LogOutput : false ,
231
226
})
232
227
233
- ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
228
+ ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitSuperLong )
234
229
defer cancel ()
235
230
236
231
logs := bytes .NewBuffer (nil )
0 commit comments