mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-09 08:26:47 +00:00
Provide support for annotations in faasd with namespaced container labels. Unit tested and confirmed with end to end test via faasd deployed to multipass VM Signed-off-by: Alex Tomic <atomic777@gmail.com>
30 lines
734 B
Go
30 lines
734 B
Go
package handlers
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func Test_BuildLabelsAndAnnotationsFromServiceSpec_Annotations(t *testing.T) {
|
|
container := map[string]string{
|
|
"qwer": "ty",
|
|
"dvor": "ak",
|
|
fmt.Sprintf("%scurrent-time", annotationLabelPrefix): "5 Nov 20:10:20 PST 1955",
|
|
fmt.Sprintf("%sfuture-time", annotationLabelPrefix): "21 Oct 20:10:20 PST 2015",
|
|
}
|
|
|
|
labels, annotation := buildLabelsAndAnnotations(container)
|
|
|
|
if len(labels) != 2 {
|
|
t.Errorf("want: %d labels got: %d", 2, len(labels))
|
|
}
|
|
|
|
if len(annotation) != 2 {
|
|
t.Errorf("want: %d annotation got: %d", 1, len(annotation))
|
|
}
|
|
|
|
if _, ok := annotation["current-time"]; !ok {
|
|
t.Errorf("want: '%s' entry in annotation map got: key not found", "current-time")
|
|
}
|
|
}
|