Skip to content

Commit aa68271

Browse files
committed
Update tests to match the new project style
1 parent 1426846 commit aa68271

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

iterative/utils/runner_test.go

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
package utils
22

3-
import "testing"
3+
import (
4+
"testing"
45

5-
func TestPositiveReadinessCheck(t *testing.T) {
6-
result := IsReady(`
7-
-- Logs begin at Wed 2021-01-20 00:25:37 UTC, end at Fri 2021-02-26 15:37:56 UTC. --
8-
Feb 26 15:37:20 ip-172-31-6-188 cml.sh[2203]: {"level":"info","time":"···","repo":"···","status":"ready"}
9-
`)
10-
if !result {
11-
t.Errorf("Positive readiness check")
12-
}
13-
}
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestReadinessCheck(t *testing.T) {
10+
t.Run("Runner log containing a readiness message should be considered ready", func(t *testing.T) {
11+
logString := `
12+
-- Logs begin at Wed 2021-01-20 00:25:37 UTC, end at Fri 2021-02-26 15:37:56 UTC. --
13+
Feb 26 15:37:20 ip-172-31-6-188 cml.sh[2203]: {"level":"info","time":"···","repo":"···","status":"ready"}
14+
`
15+
assert.True(t, IsReady(logString))
16+
})
1417

15-
func TestNegativeReadinessCheck(t *testing.T) {
16-
result := IsReady(`
17-
-- Logs begin at Wed 2021-01-20 00:25:37 UTC, end at Fri 2021-02-26 15:37:56 UTC. --
18-
Feb 26 15:37:20 ip-172-31-6-188 cml.sh[2203]: {"level":"info","time":"···","repo":"···"}
19-
`)
20-
if result {
21-
t.Errorf("Negative readiness check")
22-
}
18+
t.Run("Runner log not containing a readiness message should not be considered ready", func(t *testing.T) {
19+
logString := `
20+
-- Logs begin at Wed 2021-01-20 00:25:37 UTC, end at Fri 2021-02-26 15:37:56 UTC. --
21+
Feb 26 15:37:20 ip-172-31-6-188 cml.sh[2203]: {"level":"info","time":"···","repo":"···"}
22+
`
23+
assert.False(t, IsReady(logString))
24+
})
2325
}

0 commit comments

Comments
 (0)