19 lines
454 B
Go
19 lines
454 B
Go
package main
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
"net/http/httptest"
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestIdleStatusEmitsEmptyLogsArray(t *testing.T) {
|
||
|
|
c := &controller{status: releaseStatus{State: "idle"}}
|
||
|
|
recorder := httptest.NewRecorder()
|
||
|
|
c.handleStatus(recorder, httptest.NewRequest(http.MethodGet, "/v1/status", nil))
|
||
|
|
|
||
|
|
if got := recorder.Body.String(); !strings.Contains(got, `"logs":[]`) {
|
||
|
|
t.Fatalf("idle status must emit an empty logs array: %s", got)
|
||
|
|
}
|
||
|
|
}
|