MCPcopy
hub / github.com/openfaas/faas / TestSetReplicasNonExistentFn

Function TestSetReplicasNonExistentFn

gateway/plugin/external_test.go:97–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestSetReplicasNonExistentFn(t *testing.T) {
98
99 testServer := httptest.NewServer(
100 http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
101 res.WriteHeader(http.StatusInternalServerError)
102 }))
103 defer testServer.Close()
104
105 var injector middleware.AuthInjector
106 url, _ := url.Parse(testServer.URL + "/")
107 esq := NewExternalServiceQuery(*url, injector)
108
109 err := esq.SetReplicas("figlet", "", 1)
110
111 expectedErrStr := "error scaling HTTP code 500"
112
113 if !strings.Contains(err.Error(), expectedErrStr) {
114 t.Logf("Wanted string containing %s, got %s", expectedErrStr, err.Error())
115 t.Fail()
116 }
117}
118
119func TestSetReplicasExistentFn(t *testing.T) {
120

Callers

nothing calls this directly

Calls 2

SetReplicasMethod · 0.95
NewExternalServiceQueryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…