Cpu resources (#642)

* fn: cpu quota implementation
This commit is contained in:
Tolga Ceylan
2018-01-12 11:38:28 -08:00
committed by GitHub
parent fa59400a97
commit 39b2cb2d9b
29 changed files with 856 additions and 91 deletions

42
api/models/route_test.go Normal file
View File

@@ -0,0 +1,42 @@
package models
import (
"testing"
)
func TestRouteSimple(t *testing.T) {
route1 := &Route{
AppName: "test",
Path: "/some",
Image: "foo",
Memory: 128,
CPUs: 100,
Type: "sync",
Format: "http",
Timeout: 10,
IdleTimeout: 10,
}
err := route1.Validate()
if err != nil {
t.Fatal("should not have failed, got: ", err)
}
route2 := &Route{
AppName: "test",
Path: "/some",
Image: "foo",
Memory: 128,
CPUs: 100,
Type: "sync",
Format: "nonsense",
Timeout: 10,
IdleTimeout: 10,
}
err = route2.Validate()
if err == nil {
t.Fatalf("should have failed route: %#v", route2)
}
}