mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-09 00:16:46 +00:00
This commit allows the provider to return a list of the names of the secrets mapped into an openfaas function. This was tested by building and deploying faasd on multipass and curling the provider directly and seeing the returned secrets list! Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
40 lines
990 B
Go
40 lines
990 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/openfaas/faas-provider/types"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func Test_InfoHandler(t *testing.T) {
|
|
sha := "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
|
|
version := "0.0.1"
|
|
handler := MakeInfoHandler(version, sha)
|
|
w := httptest.NewRecorder()
|
|
r := httptest.NewRequest("GET", "/", nil)
|
|
handler(w, r)
|
|
|
|
resp := types.ProviderInfo{}
|
|
err := json.Unmarshal(w.Body.Bytes(), &resp)
|
|
if err != nil {
|
|
t.Fatalf("unexpected error unmarshalling the response")
|
|
}
|
|
|
|
if resp.Name != ProviderName {
|
|
t.Fatalf("expected provider %q, got %q", ProviderName, resp.Name)
|
|
}
|
|
|
|
if resp.Orchestration != OrchestrationIdentifier {
|
|
t.Fatalf("expected orchestration %q, got %q", OrchestrationIdentifier, resp.Orchestration)
|
|
}
|
|
|
|
if resp.Version.SHA != sha {
|
|
t.Fatalf("expected orchestration %q, got %q", sha, resp.Version.SHA)
|
|
}
|
|
|
|
if resp.Version.Release != version {
|
|
t.Fatalf("expected release %q, got %q", version, resp.Version.Release)
|
|
}
|
|
}
|