mirror of
https://github.com/openfaas/faas.git
synced 2025-06-25 08:13:25 +00:00
Scale functions with namespace option
Allows alerts to trigger functions to scale when they also have an optional namespace set. Tested e2e with Kubernetes 1.15 and a non-default namespace. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
committed by
Alex Ellis
parent
238ce1be23
commit
df4126d8f5
45
gateway/handlers/namespaces_test.go
Normal file
45
gateway/handlers/namespaces_test.go
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (c) Alex Ellis 2017. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
package handlers
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_getNamespace_Default(t *testing.T) {
|
||||
root, ns := getNamespace("openfaas-fn", "figlet.openfaas-fn")
|
||||
wantRoot := "figlet"
|
||||
wantNs := "openfaas-fn"
|
||||
|
||||
if root != wantRoot {
|
||||
t.Errorf("function root: want %s, got %s", wantRoot, root)
|
||||
}
|
||||
if ns != wantNs {
|
||||
t.Errorf("function ns: want %s, got %s", wantNs, ns)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getNamespace_Override(t *testing.T) {
|
||||
root, ns := getNamespace("fn", "figlet.fn")
|
||||
wantRoot := "figlet"
|
||||
wantNs := "fn"
|
||||
|
||||
if root != wantRoot {
|
||||
t.Errorf("function root: want %s, got %s", wantRoot, root)
|
||||
}
|
||||
if ns != wantNs {
|
||||
t.Errorf("function ns: want %s, got %s", wantNs, ns)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getNamespace_Empty(t *testing.T) {
|
||||
root, ns := getNamespace("", "figlet")
|
||||
wantRoot := "figlet"
|
||||
wantNs := ""
|
||||
|
||||
if root != wantRoot {
|
||||
t.Errorf("function root: want %s, got %s", wantRoot, root)
|
||||
}
|
||||
if ns != wantNs {
|
||||
t.Errorf("function ns: want %s, got %s", wantNs, ns)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user