(t *testing.T)
| 670 | } |
| 671 | |
| 672 | func TestSyncStandbyClusterConfiguration(t *testing.T) { |
| 673 | client, _ := newFakeK8sSyncClient() |
| 674 | clusterName := "acid-standby-cluster" |
| 675 | applicationLabel := "spilo" |
| 676 | namespace := "default" |
| 677 | |
| 678 | ctrl := gomock.NewController(t) |
| 679 | defer ctrl.Finish() |
| 680 | |
| 681 | pg := acidv1.Postgresql{ |
| 682 | ObjectMeta: metav1.ObjectMeta{ |
| 683 | Name: clusterName, |
| 684 | Namespace: namespace, |
| 685 | }, |
| 686 | Spec: acidv1.PostgresSpec{ |
| 687 | NumberOfInstances: int32(1), |
| 688 | Volume: acidv1.Volume{ |
| 689 | Size: "1Gi", |
| 690 | }, |
| 691 | }, |
| 692 | } |
| 693 | |
| 694 | var cluster = New( |
| 695 | Config{ |
| 696 | OpConfig: config.Config{ |
| 697 | PatroniAPICheckInterval: time.Duration(1), |
| 698 | PatroniAPICheckTimeout: time.Duration(5), |
| 699 | PodManagementPolicy: "ordered_ready", |
| 700 | Resources: config.Resources{ |
| 701 | ClusterLabels: map[string]string{"application": applicationLabel}, |
| 702 | ClusterNameLabel: "cluster-name", |
| 703 | DefaultCPURequest: "300m", |
| 704 | DefaultCPULimit: "300m", |
| 705 | DefaultMemoryRequest: "300Mi", |
| 706 | DefaultMemoryLimit: "300Mi", |
| 707 | MinInstances: int32(-1), |
| 708 | MaxInstances: int32(-1), |
| 709 | PodRoleLabel: "spilo-role", |
| 710 | ResourceCheckInterval: time.Duration(3), |
| 711 | ResourceCheckTimeout: time.Duration(10), |
| 712 | }, |
| 713 | }, |
| 714 | }, client, pg, logger, eventRecorder) |
| 715 | |
| 716 | cluster.Name = clusterName |
| 717 | cluster.Namespace = namespace |
| 718 | |
| 719 | // mocking a config after getConfig is called |
| 720 | mockClient := mocks.NewMockHTTPClient(ctrl) |
| 721 | configJson := `{"ttl": 20}` |
| 722 | r := io.NopCloser(bytes.NewReader([]byte(configJson))) |
| 723 | response := http.Response{ |
| 724 | StatusCode: 200, |
| 725 | Body: r, |
| 726 | } |
| 727 | mockClient.EXPECT().Get(gomock.Any()).Return(&response, nil).AnyTimes() |
| 728 | |
| 729 | // mocking a config after setConfig is called |
nothing calls this directly
no test coverage detected