(t *testing.T)
| 656 | } |
| 657 | |
| 658 | func TestReloadCommand(t *testing.T) { |
| 659 | shellcheck := require.ShellCheck(t) |
| 660 | |
| 661 | repo1Size := resource.MustParse("1Gi") |
| 662 | repo2Size := resource.MustParse("2Gi") |
| 663 | repo3Size := resource.MustParse("3Gi") |
| 664 | repo4Size := resource.MustParse("4Gi") |
| 665 | |
| 666 | // Create a command with all four repos having auto-grow enabled. |
| 667 | // Check that the generated script has the correct values for each repo |
| 668 | // when calling manageAutogrowAnnotation. |
| 669 | // |
| 670 | // Note that the actual values for trigger and max-grow are not important |
| 671 | // here, just that they are correctly passed through to the script. |
| 672 | command := reloadCommand("some-name", []v1beta1.PGBackRestRepo{{ |
| 673 | Name: "repo1", |
| 674 | Volume: &v1beta1.RepoPVC{ |
| 675 | VolumeClaimSpec: v1beta1.VolumeClaimSpecWithAutoGrow{ |
| 676 | AutoGrow: &v1beta1.AutoGrowSpec{ |
| 677 | Trigger: initialize.Int32(10), |
| 678 | MaxGrow: &repo1Size, |
| 679 | }, |
| 680 | }, |
| 681 | }, |
| 682 | }, { |
| 683 | Name: "repo2", |
| 684 | Volume: &v1beta1.RepoPVC{ |
| 685 | VolumeClaimSpec: v1beta1.VolumeClaimSpecWithAutoGrow{ |
| 686 | AutoGrow: &v1beta1.AutoGrowSpec{ |
| 687 | Trigger: initialize.Int32(20), |
| 688 | MaxGrow: &repo2Size, |
| 689 | }, |
| 690 | }, |
| 691 | }, |
| 692 | }, { |
| 693 | Name: "repo3", |
| 694 | Volume: &v1beta1.RepoPVC{ |
| 695 | VolumeClaimSpec: v1beta1.VolumeClaimSpecWithAutoGrow{ |
| 696 | AutoGrow: &v1beta1.AutoGrowSpec{ |
| 697 | Trigger: initialize.Int32(30), |
| 698 | MaxGrow: &repo3Size, |
| 699 | }, |
| 700 | }, |
| 701 | }, |
| 702 | }, { |
| 703 | Name: "repo4", |
| 704 | Volume: &v1beta1.RepoPVC{ |
| 705 | VolumeClaimSpec: v1beta1.VolumeClaimSpecWithAutoGrow{ |
| 706 | AutoGrow: &v1beta1.AutoGrowSpec{ |
| 707 | Trigger: initialize.Int32(40), |
| 708 | MaxGrow: &repo4Size, |
| 709 | }, |
| 710 | }, |
| 711 | }, |
| 712 | }}) |
| 713 | |
| 714 | // Expect a bash command with an inline script. |
| 715 | assert.DeepEqual(t, command[:3], []string{"bash", "-ceu", "--"}) |
nothing calls this directly
no test coverage detected