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

Function TestInstanceYAML

internal/patroni/config_test.go:650–710  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

648}
649
650func TestInstanceYAML(t *testing.T) {
651 t.Parallel()
652
653 cluster := &v1beta1.PostgresCluster{Spec: v1beta1.PostgresClusterSpec{PostgresVersion: 12}}
654 instance := new(v1beta1.PostgresInstanceSetSpec)
655
656 data, err := instanceYAML(cluster, instance, nil)
657 assert.NilError(t, err)
658 assert.Equal(t, data, strings.Trim(`
659# Generated by postgres-operator. DO NOT EDIT.
660# Your changes will not be saved.
661bootstrap:
662 initdb:
663 - allow-group-access
664 - data-checksums
665 - encoding=UTF8
666 - waldir=/pgdata/pg12_wal
667 method: initdb
668kubernetes: {}
669postgresql:
670 basebackup:
671 - waldir=/pgdata/pg12_wal
672 create_replica_methods:
673 - basebackup
674 pgpass: /tmp/.pgpass
675 use_unix_socket: true
676restapi: {}
677tags: {}
678 `, "\t\n")+"\n")
679
680 dataWithReplicaCreate, err := instanceYAML(cluster, instance, []string{"some", "backrest", "cmd"})
681 assert.NilError(t, err)
682 assert.Equal(t, dataWithReplicaCreate, strings.Trim(`
683# Generated by postgres-operator. DO NOT EDIT.
684# Your changes will not be saved.
685bootstrap:
686 initdb:
687 - allow-group-access
688 - data-checksums
689 - encoding=UTF8
690 - waldir=/pgdata/pg12_wal
691 method: initdb
692kubernetes: {}
693postgresql:
694 basebackup:
695 - waldir=/pgdata/pg12_wal
696 create_replica_methods:
697 - pgbackrest
698 - basebackup
699 pgbackrest:
700 command: '''some'' ''backrest'' ''cmd'''
701 keep_data: true
702 no_leader: true
703 no_params: true
704 pgpass: /tmp/.pgpass
705 use_unix_socket: true
706restapi: {}
707tags: {}

Callers

nothing calls this directly

Calls 2

instanceYAMLFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected