diff --git a/config/loader_test.go b/config/loader_test.go index 09f25a7..85c1f1f 100644 --- a/config/loader_test.go +++ b/config/loader_test.go @@ -77,6 +77,19 @@ policies: assert.NotNil(t, err) } +func TestLoadPolicies(t *testing.T) { + // Service as integer + configs, err := loadTempFiles(` +service: 1 +policies: + - + id: "1" + effect: allow +`) + assert.Nil(t, err) + assert.Equal(t, configs[0].Service, "1") +} + func TestLoadFolder(t *testing.T) { // Create temp dir dir, err := ioutil.TempDir("", "example") diff --git a/doorman/doorman_ladon_test.go b/doorman/doorman_ladon_test.go index 6096f1e..f26aa46 100644 --- a/doorman/doorman_ladon_test.go +++ b/doorman/doorman_ladon_test.go @@ -158,6 +158,25 @@ func TestBadServicesConfig(t *testing.T) { }, }) assert.NotNil(t, err) + + // Unknown condition type + err = d.LoadPolicies(ServicesConfig{ + ServiceConfig{ + Service: "a", + Policies: Policies{ + Policy{ + ID: "1", + Conditions: Conditions{ + "owner": Condition{ + Type: "healthy", + }, + }, + Effect: "allow", + }, + }, + }, + }) + assert.NotNil(t, err) } func TestLoadPoliciesTwice(t *testing.T) {