@@ -2,7 +2,6 @@ package integration
2
2
3
3
import (
4
4
"fmt"
5
- "io/ioutil"
6
5
"net"
7
6
"os"
8
7
"path/filepath"
@@ -53,15 +52,15 @@ func (suite *SvcIntegrationTestSuite) TestStartStop() {
53
52
cp .Expect ("Checking" )
54
53
55
54
// Verify the server is running on its reported port.
56
- cp .ExpectRe (" Port:\\ s+:\\ d+\\ s" )
57
- portRe := regexp .MustCompile (" Port:\\ s+:(\\ d+)" )
55
+ cp .ExpectRe (` Port:\s+:\d+\s` )
56
+ portRe := regexp .MustCompile (` Port:\s+:(\d+)` )
58
57
port := portRe .FindStringSubmatch (cp .Output ())[1 ]
59
58
_ , err := net .Listen ("tcp" , "localhost:" + port )
60
59
suite .Error (err )
61
60
62
61
// Verify it created and wrote to its reported log file.
63
- cp .ExpectRe (" Log:\\ s+ .+?\\ .log" )
64
- logRe := regexp .MustCompile (" Log:\\ s+(.+?\\ .log)" )
62
+ cp .ExpectRe (` Log:\s+( .+?\.log)` )
63
+ logRe := regexp .MustCompile (` Log:\s+(.+?\.log)` )
65
64
logFile := logRe .FindStringSubmatch (cp .Output ())[1 ]
66
65
suite .True (fileutils .FileExists (logFile ), "log file '" + logFile + "' does not exist" )
67
66
suite .True (len (fileutils .ReadFileUnsafe (logFile )) > 0 , "log file is empty" )
@@ -99,7 +98,8 @@ func (suite *SvcIntegrationTestSuite) TestSignals() {
99
98
cp := ts .SpawnCmdWithOpts (ts .SvcExe , e2e .OptArgs ("foreground" ))
100
99
cp .Expect ("Starting" )
101
100
time .Sleep (1 * time .Second ) // wait for the service to start up
102
- cp .Cmd ().Process .Signal (syscall .SIGINT )
101
+ err := cp .Cmd ().Process .Signal (syscall .SIGINT )
102
+ suite .NoError (err )
103
103
cp .Expect ("caught a signal: interrupt" )
104
104
cp .ExpectNotExitCode (0 )
105
105
@@ -114,7 +114,8 @@ func (suite *SvcIntegrationTestSuite) TestSignals() {
114
114
cp = ts .SpawnCmdWithOpts (ts .SvcExe , e2e .OptArgs ("foreground" ))
115
115
cp .Expect ("Starting" )
116
116
time .Sleep (1 * time .Second ) // wait for the service to start up
117
- cp .Cmd ().Process .Signal (syscall .SIGTERM )
117
+ err = cp .Cmd ().Process .Signal (syscall .SIGTERM )
118
+ suite .NoError (err )
118
119
suite .NotContains (cp .Output (), "caught a signal" )
119
120
cp .ExpectExitCode (0 ) // should exit gracefully
120
121
@@ -257,7 +258,7 @@ func (suite *SvcIntegrationTestSuite) TestLogRotation() {
257
258
time .Sleep (initialWait ) // wait for state-svc to perform initial log rotation
258
259
259
260
// Verify the log rotation pruned the dummy log files.
260
- files , err := ioutil .ReadDir (logDir )
261
+ files , err := os .ReadDir (logDir )
261
262
suite .Require ().NoError (err )
262
263
remainingFooFiles := 0
263
264
for _ , file := range files {
@@ -281,7 +282,7 @@ func (suite *SvcIntegrationTestSuite) TestLogRotation() {
281
282
time .Sleep (logRotateInterval - initialWait ) // wait for another log rotation
282
283
283
284
// Verify that another log rotation pruned the dummy log files.
284
- files , err = ioutil .ReadDir (logDir )
285
+ files , err = os .ReadDir (logDir )
285
286
suite .Require ().NoError (err )
286
287
remainingFooFiles = 0
287
288
for _ , file := range files {
0 commit comments