MCPcopy Create free account
hub / github.com/CrunchyData/postgres-operator / TestGenerateInstance

Function TestGenerateInstance

internal/naming/names_test.go:266–278  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

264}
265
266func TestGenerateInstance(t *testing.T) {
267 cluster := &v1beta1.PostgresCluster{
268 ObjectMeta: metav1.ObjectMeta{
269 Namespace: "ns1", Name: "pg0",
270 },
271 }
272 set := &v1beta1.PostgresInstanceSetSpec{Name: "hippos"}
273
274 instance := GenerateInstance(cluster, set)
275
276 assert.Equal(t, cluster.Namespace, instance.Namespace)
277 assert.Assert(t, strings.HasPrefix(instance.Name, cluster.Name+"-"+set.Name+"-"))
278}
279
280// TestGenerateStartupInstance ensures that a consistent ObjectMeta will be
281// provided assuming the same cluster name and instance set name is passed

Callers

nothing calls this directly

Calls 2

GenerateInstanceFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected