Skip to content

Commit

Permalink
fixup! Bulk convert to using testify/suite for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashb committed May 8, 2023
1 parent f6435f8 commit 6845b64
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
8 changes: 2 additions & 6 deletions houston/decorator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import (
var errMockHouston = errors.New("mock houston error")

func (s *Suite) Test_isCalledFromUnitTestFile() {
if got := isCalledFromUnitTestFile(); got != true {
t.Errorf("isCalledFromUnitTestFile() = %v, want %v", got, true)
}
s.True(isCalledFromUnitTestFile())
}

func (s *Suite) TestSanitiseVersionString() {
Expand Down Expand Up @@ -39,9 +37,7 @@ func (s *Suite) TestSanitiseVersionString() {
}
for _, tt := range tests {
s.Run(tt.name, func() {
if got := sanitiseVersionString(tt.args.v); got != tt.want {
t.Errorf("sanitiseVersionString() = %v, want %v", got, tt.want)
}
s.Equal(sanitiseVersionString(tt.args.v), tt.want)
})
}
}
Expand Down
6 changes: 3 additions & 3 deletions houston/websocket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func (s *Suite) TestBuildDeploymentLogsSubscribeRequest() {

func (s *Suite) TestSubscribe() {
// Create test server with the echo handler.
s := httptest.NewServer(http.HandlerFunc(websocketHandler))
defer s.Close()
sock := httptest.NewServer(http.HandlerFunc(websocketHandler))
defer sock.Close()

s.Run("success", func() {
// Convert http://127.0.0.1 to ws://127.0.0.
url := "ws" + strings.TrimPrefix(s.URL, "http")
url := "ws" + strings.TrimPrefix(sock.URL, "http")

err := Subscribe("test-token", url, `{"type": "test", "payload": {"data": {"log": {"log": "test"}}}}`)
s.NoError(err)
Expand Down
3 changes: 0 additions & 3 deletions software/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,6 @@ Nothing to cancel. You are currently running Airflow 1.10.10 and you have not in

buf := new(bytes.Buffer)
err = AirflowUpgrade(deploymentID, "", api, buf)
t.Log(buf.String()) // Log the buffer so that this test is recognized by go test

s.NoError(err)
expected := `# AIRFLOW VERSION
Expand Down Expand Up @@ -891,7 +890,6 @@ func (s *Suite) Test_getAirflowVersionSelection() {
os.Stdin = r

airflowVersion, err := getAirflowVersionSelection("1.10.7", api, buf)
t.Log(buf.String()) // Log the buffer so that this test is recognized by go test
s.NoError(err)
s.Equal("1.10.12", airflowVersion)
api.AssertExpectations(s.T())
Expand Down Expand Up @@ -1343,7 +1341,6 @@ To cancel, run:

buf := new(bytes.Buffer)
err = RuntimeUpgrade(mockDeployment.ID, "", api, buf)
t.Log(buf.String()) // Log the buffer so that this test is recognized by go test

s.NoError(err)
expected := `# RUNTIME VERSION
Expand Down

0 comments on commit 6845b64

Please sign in to comment.