| 430 | } |
| 431 | |
| 432 | func TestLoadConfigFile(t *testing.T) { |
| 433 | expected := configFile{ |
| 434 | CreationRules: []creationRule{ |
| 435 | { |
| 436 | PathRegex: "foobar*", |
| 437 | KMS: "1", |
| 438 | PGP: "2", |
| 439 | GCPKMS: "3", |
| 440 | HCKms: []string{"tr-west-1:test-key-1"}, |
| 441 | VaultURI: "http://4:8200/v1/4/keys/4", |
| 442 | }, |
| 443 | { |
| 444 | PathRegex: "", |
| 445 | KMS: "foo", |
| 446 | PGP: "bar", |
| 447 | GCPKMS: "baz", |
| 448 | HCKms: []string{"tr-west-1:test-key-2"}, |
| 449 | VaultURI: "http://127.0.1.1/v1/baz/keys/baz", |
| 450 | }, |
| 451 | }, |
| 452 | } |
| 453 | |
| 454 | conf := configFile{} |
| 455 | err := conf.load(sampleConfig) |
| 456 | assert.Nil(t, err) |
| 457 | assert.Equal(t, expected, conf) |
| 458 | } |
| 459 | |
| 460 | func TestLoadConfigFileWithGroups(t *testing.T) { |
| 461 | bam := "bam" |