(t *testing.T)
| 648 | } |
| 649 | |
| 650 | func 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. |
| 661 | bootstrap: |
| 662 | initdb: |
| 663 | - allow-group-access |
| 664 | - data-checksums |
| 665 | - encoding=UTF8 |
| 666 | - waldir=/pgdata/pg12_wal |
| 667 | method: initdb |
| 668 | kubernetes: {} |
| 669 | postgresql: |
| 670 | basebackup: |
| 671 | - waldir=/pgdata/pg12_wal |
| 672 | create_replica_methods: |
| 673 | - basebackup |
| 674 | pgpass: /tmp/.pgpass |
| 675 | use_unix_socket: true |
| 676 | restapi: {} |
| 677 | tags: {} |
| 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. |
| 685 | bootstrap: |
| 686 | initdb: |
| 687 | - allow-group-access |
| 688 | - data-checksums |
| 689 | - encoding=UTF8 |
| 690 | - waldir=/pgdata/pg12_wal |
| 691 | method: initdb |
| 692 | kubernetes: {} |
| 693 | postgresql: |
| 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 |
| 706 | restapi: {} |
| 707 | tags: {} |
nothing calls this directly
no test coverage detected