MCPcopy
hub / github.com/getsops/sops / TestLoadConfigFileWithMerge

Function TestLoadConfigFileWithMerge

config/config_test.go:544–578  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

542}
543
544func TestLoadConfigFileWithMerge(t *testing.T) {
545 conf, err := parseCreationRuleForFile(parseConfigFile(sampleConfigWithMergeType, t), "/conf/path", "whatever", nil)
546 assert.Nil(t, err)
547 assert.Equal(t, 2, len(conf.KeyGroups))
548 assert.Equal(t, []string{
549 "hc_vault: https://foo.vault:8200/v1/foo/keys/foo-key",
550 }, ids(conf.KeyGroups[0]))
551 assert.Equal(t, []string{
552 "pgp: foo", // key01
553 "kms: foo||foo", //key02
554 "kms: foo+123|baz:bam|bar", //key03
555 "gcp_kms: foo", //key04
556 "azure_kv: https://foo.vault.azure.net/keys/foo-key/fooversion", //key05
557 "hc_vault: https://bar.vault:8200/v1/bar/keys/bar-key", //key06
558 "pgp: bar", //key07
559 "kms: bar||bar", //key08
560 "gcp_kms: bar", //key09
561 "gcp_kms: baz", //key10
562 "azure_kv: https://bar.vault.azure.net/keys/bar-key/barversion", //key11
563 "hc_vault: https://baz.vault:8200/v1/baz/keys/baz-key", //key12
564 "pgp: baz", //key13
565 "kms: baz||baz", //key14
566 "hc_vault: https://foo.vault:8200/v1/foo/keys/foo-key", //key15
567 "pgp: qux", //key16
568 "kms: qux||qux", //key17
569 "kms: baz||bar", //key18
570 "kms: baz+123", //key19
571 "gcp_kms: qux", //key20
572 "gcp_kms: fnord", //key21
573 "azure_kv: https://baz.vault.azure.net/keys/baz-key/bazversion", //key22
574 "hc_vault: https://qux.vault:8200/v1/qux/keys/qux-key", //key23
575 "kms: fnord||fnord", //key24
576 "hc_vault: https://fnord.vault:8200/v1/fnord/keys/fnord-key", //key25
577 }, ids(conf.KeyGroups[1]))
578}
579
580func TestLoadConfigFileWithNoMatchingRules(t *testing.T) {
581 _, err := parseCreationRuleForFile(parseConfigFile(sampleConfigWithNoMatchingRules, t), "/conf/path", "foobar2000", nil)

Callers

nothing calls this directly

Calls 3

parseCreationRuleForFileFunction · 0.85
parseConfigFileFunction · 0.85
idsFunction · 0.85

Tested by

no test coverage detected