mirror of
https://github.com/openfaas/faas.git
synced 2025-06-18 03:56:37 +00:00
Migrate to Go modules
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
2e2250afe8
commit
7ce266adc0
@ -27,7 +27,6 @@ func TestCreate_ValidRequest(t *testing.T) {
|
||||
request := types.FunctionDeployment{
|
||||
Service: "test_resizer",
|
||||
Image: "functions/resizer",
|
||||
Network: "func_functions",
|
||||
EnvProcess: "",
|
||||
}
|
||||
|
||||
@ -51,7 +50,6 @@ func TestCreate_InvalidImage(t *testing.T) {
|
||||
request := types.FunctionDeployment{
|
||||
Service: "test_resizer",
|
||||
Image: "a b c",
|
||||
Network: "func_functions",
|
||||
EnvProcess: "",
|
||||
}
|
||||
|
||||
@ -75,34 +73,6 @@ func TestCreate_InvalidImage(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreate_InvalidNetwork(t *testing.T) {
|
||||
request := types.FunctionDeployment{
|
||||
Service: "test_resizer",
|
||||
Image: "functions/resizer",
|
||||
Network: "non_existent_network",
|
||||
EnvProcess: "",
|
||||
}
|
||||
|
||||
body, code, err := createFunction(request)
|
||||
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
expectedErrorCode := http.StatusBadRequest
|
||||
if code != expectedErrorCode {
|
||||
t.Errorf("Got HTTP code: %d, want %d\n", code, expectedErrorCode)
|
||||
return
|
||||
}
|
||||
|
||||
expectedErrorSlice := "network non_existent_network not found"
|
||||
if !strings.Contains(body, expectedErrorSlice) {
|
||||
t.Errorf("Error message %s does not contain: %s\n", body, expectedErrorSlice)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreate_InvalidJson(t *testing.T) {
|
||||
reqBody := `not json`
|
||||
_, code, err := fireRequest("http://localhost:8080/system/functions", http.MethodPost, reqBody)
|
||||
|
Reference in New Issue
Block a user