Allow dot in function name

This patch enables the use-case for multiple namepsaces by
allowing a dot to be used in the function name.

dep has been run to update OpenFaaS projects and also to
prune unused files.

Tested by doing a build.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2019-09-20 11:12:19 +01:00
committed by Alex Ellis
parent dc3c5fb9b3
commit 0a90125aba
1298 changed files with 86 additions and 629745 deletions

View File

@ -1,40 +0,0 @@
package handler
import (
"os"
"strings"
"testing"
"github.com/openfaas/nats-queue-worker/nats"
)
func Test_GetClientID_ContainsHostname(t *testing.T) {
c := DefaultNATSConfig{}
val := c.GetClientID()
hostname, _ := os.Hostname()
encodedHostname := nats.GetClientID(hostname)
if !strings.HasSuffix(val, encodedHostname) {
t.Errorf("GetClientID should contain hostname as suffix, got: %s", val)
t.Fail()
}
}
func TestCreategetClientID(t *testing.T) {
clientID := getClientID("computer-a")
want := "faas-publisher-computer-a"
if clientID != want {
t.Logf("Want clientID: `%s`, but got: `%s`\n", want, clientID)
t.Fail()
}
}
func TestCreategetClientIDWhenHostHasUnsupportedCharacters(t *testing.T) {
clientID := getClientID("computer-a.acme.com")
want := "faas-publisher-computer-a_acme_com"
if clientID != want {
t.Logf("Want clientID: `%s`, but got: `%s`\n", want, clientID)
t.Fail()
}
}