mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
consul: additional unit test for consul config merging (#23495)
This commit is contained in:
committed by
GitHub
parent
1f915c0f8f
commit
88e8973004
@@ -1742,3 +1742,40 @@ func TestParseMultipleIPTemplates(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// this test makes sure Consul configs with and without WI merging happens
|
||||
// correctly; here to assure we don't introduce regressions
|
||||
func Test_mergeConsulConfigs(t *testing.T) {
|
||||
ci.Parallel(t)
|
||||
|
||||
c0 := &Config{
|
||||
Consuls: []*config.ConsulConfig{
|
||||
{
|
||||
Token: "foo",
|
||||
AllowUnauthenticated: pointer.Of(true),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
c1 := &Config{
|
||||
Consuls: []*config.ConsulConfig{
|
||||
{
|
||||
ServiceIdentity: &config.WorkloadIdentityConfig{
|
||||
Audience: []string{"consul.io"},
|
||||
TTL: pointer.Of(time.Hour),
|
||||
},
|
||||
TaskIdentity: &config.WorkloadIdentityConfig{
|
||||
Audience: []string{"consul.io"},
|
||||
TTL: pointer.Of(time.Hour),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
result := c0.Merge(c1)
|
||||
|
||||
must.Eq(t, c1.Consuls[0].ServiceIdentity, result.Consuls[0].ServiceIdentity)
|
||||
must.Eq(t, c1.Consuls[0].TaskIdentity, result.Consuls[0].TaskIdentity)
|
||||
must.Eq(t, c0.Consuls[0].Token, result.Consuls[0].Token)
|
||||
must.Eq(t, c0.Consuls[0].AllowUnauthenticated, result.Consuls[0].AllowUnauthenticated)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user