|
51 | 51 | testDBClusterParameterGroupName = "some-db-cluster-parameter-group" |
52 | 52 | testOtherDBClusterParameterGroupName = "some-other-db-cluster-parameter-group" |
53 | 53 | testDBSubnetGroupName = "some-db-subnet-group" |
54 | | - testOtherDBSubnetGroupName = "some-other-db-subnet-group" |
55 | 54 | testCloudWatchLog = "some-log" |
56 | 55 | testOtherCloudWatchLog = "some-other-log" |
57 | 56 | testEngine = "some-engine" |
@@ -174,12 +173,6 @@ func withDBSubnetGroup(value string) docDBModifier { |
174 | 173 | } |
175 | 174 | } |
176 | 175 |
|
177 | | -func withStatusDBSubnetGroup(value string) docDBModifier { |
178 | | - return func(o *svcapitypes.DBCluster) { |
179 | | - o.Status.AtProvider.DBSubnetGroup = awsclient.String(value) |
180 | | - } |
181 | | -} |
182 | | - |
183 | 176 | func withDeletionProtection(value bool) docDBModifier { |
184 | 177 | return func(o *svcapitypes.DBCluster) { |
185 | 178 | o.Spec.ForProvider.DeletionProtection = awsclient.Bool(value, awsclient.FieldRequired) |
@@ -718,172 +711,6 @@ func TestObserve(t *testing.T) { |
718 | 711 | }, |
719 | 712 | }, |
720 | 713 | }, |
721 | | - "AvailableState_and_changed_DBSubnetGroupName_should_not_be_UpToDate": { |
722 | | - args: args{ |
723 | | - docdb: &fake.MockDocDBClient{ |
724 | | - MockDescribeDBClustersWithContext: func(c context.Context, ddi *docdb.DescribeDBClustersInput, o []request.Option) (*docdb.DescribeDBClustersOutput, error) { |
725 | | - return &docdb.DescribeDBClustersOutput{ |
726 | | - DBClusters: []*docdb.DBCluster{ |
727 | | - { |
728 | | - DBClusterIdentifier: awsclient.String(testDBClusterIdentifier), |
729 | | - Status: awsclient.String(svcapitypes.DocDBInstanceStateAvailable), |
730 | | - DBSubnetGroup: awsclient.String(testDBSubnetGroupName), |
731 | | - }, |
732 | | - }, |
733 | | - }, nil |
734 | | - }, |
735 | | - }, |
736 | | - cr: instance( |
737 | | - withDBClusterIdentifier(testDBClusterIdentifier), |
738 | | - withExternalName(testDBClusterIdentifier), |
739 | | - withDBSubnetGroup(testOtherDBSubnetGroupName), |
740 | | - ), |
741 | | - }, |
742 | | - want: want{ |
743 | | - cr: instance( |
744 | | - withDBClusterIdentifier(testDBClusterIdentifier), |
745 | | - withExternalName(testDBClusterIdentifier), |
746 | | - withConditions(xpv1.Available()), |
747 | | - withStatus(svcapitypes.DocDBInstanceStateAvailable), |
748 | | - withDBSubnetGroup(testOtherDBSubnetGroupName), |
749 | | - withStatusDBSubnetGroup(testDBSubnetGroupName), |
750 | | - withVpcSecurityGroupIds(), |
751 | | - ), |
752 | | - result: managed.ExternalObservation{ |
753 | | - ResourceExists: true, |
754 | | - ResourceUpToDate: false, |
755 | | - ResourceLateInitialized: true, |
756 | | - ConnectionDetails: generateConnectionDetails("", "", "", "", 0), |
757 | | - }, |
758 | | - docdb: fake.MockDocDBClientCall{ |
759 | | - DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{ |
760 | | - { |
761 | | - Ctx: context.Background(), |
762 | | - I: &docdb.DescribeDBClustersInput{ |
763 | | - DBClusterIdentifier: awsclient.String(testDBClusterIdentifier), |
764 | | - }, |
765 | | - }, |
766 | | - }, |
767 | | - }, |
768 | | - }, |
769 | | - }, |
770 | | - "AvailableState_and_same_DBSubnetGroupName_should_be_UpToDate": { |
771 | | - args: args{ |
772 | | - docdb: &fake.MockDocDBClient{ |
773 | | - MockDescribeDBClustersWithContext: func(c context.Context, ddi *docdb.DescribeDBClustersInput, o []request.Option) (*docdb.DescribeDBClustersOutput, error) { |
774 | | - return &docdb.DescribeDBClustersOutput{ |
775 | | - DBClusters: []*docdb.DBCluster{ |
776 | | - { |
777 | | - DBClusterIdentifier: awsclient.String(testDBClusterIdentifier), |
778 | | - Status: awsclient.String(svcapitypes.DocDBInstanceStateAvailable), |
779 | | - DBSubnetGroup: awsclient.String(testDBSubnetGroupName), |
780 | | - }, |
781 | | - }, |
782 | | - }, nil |
783 | | - }, |
784 | | - MockListTagsForResource: func(ltfri *docdb.ListTagsForResourceInput) (*docdb.ListTagsForResourceOutput, error) { |
785 | | - return &docdb.ListTagsForResourceOutput{ |
786 | | - TagList: []*docdb.Tag{}, |
787 | | - }, nil |
788 | | - }, |
789 | | - }, |
790 | | - cr: instance( |
791 | | - withDBClusterIdentifier(testDBClusterIdentifier), |
792 | | - withExternalName(testDBClusterIdentifier), |
793 | | - withDBSubnetGroup(testDBSubnetGroupName), |
794 | | - ), |
795 | | - }, |
796 | | - want: want{ |
797 | | - cr: instance( |
798 | | - withDBClusterIdentifier(testDBClusterIdentifier), |
799 | | - withExternalName(testDBClusterIdentifier), |
800 | | - withConditions(xpv1.Available()), |
801 | | - withStatus(svcapitypes.DocDBInstanceStateAvailable), |
802 | | - withDBSubnetGroup(testDBSubnetGroupName), |
803 | | - withStatusDBSubnetGroup(testDBSubnetGroupName), |
804 | | - withVpcSecurityGroupIds(), |
805 | | - ), |
806 | | - result: managed.ExternalObservation{ |
807 | | - ResourceExists: true, |
808 | | - ResourceUpToDate: true, |
809 | | - ResourceLateInitialized: true, |
810 | | - ConnectionDetails: generateConnectionDetails("", "", "", "", 0), |
811 | | - }, |
812 | | - docdb: fake.MockDocDBClientCall{ |
813 | | - DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{ |
814 | | - { |
815 | | - Ctx: context.Background(), |
816 | | - I: &docdb.DescribeDBClustersInput{ |
817 | | - DBClusterIdentifier: awsclient.String(testDBClusterIdentifier), |
818 | | - }, |
819 | | - }, |
820 | | - }, |
821 | | - ListTagsForResource: []*fake.CallListTagsForResource{ |
822 | | - { |
823 | | - I: &docdb.ListTagsForResourceInput{}, |
824 | | - }, |
825 | | - }, |
826 | | - }, |
827 | | - }, |
828 | | - }, |
829 | | - "AvailableState_and_no_spec_DBSubnetGroupName_should_be_UpToDate": { |
830 | | - args: args{ |
831 | | - docdb: &fake.MockDocDBClient{ |
832 | | - MockDescribeDBClustersWithContext: func(c context.Context, ddi *docdb.DescribeDBClustersInput, o []request.Option) (*docdb.DescribeDBClustersOutput, error) { |
833 | | - return &docdb.DescribeDBClustersOutput{ |
834 | | - DBClusters: []*docdb.DBCluster{ |
835 | | - { |
836 | | - DBClusterIdentifier: awsclient.String(testDBClusterIdentifier), |
837 | | - Status: awsclient.String(svcapitypes.DocDBInstanceStateAvailable), |
838 | | - DBSubnetGroup: awsclient.String(testDBSubnetGroupName), |
839 | | - }, |
840 | | - }, |
841 | | - }, nil |
842 | | - }, |
843 | | - MockListTagsForResource: func(ltfri *docdb.ListTagsForResourceInput) (*docdb.ListTagsForResourceOutput, error) { |
844 | | - return &docdb.ListTagsForResourceOutput{ |
845 | | - TagList: []*docdb.Tag{}, |
846 | | - }, nil |
847 | | - }, |
848 | | - }, |
849 | | - cr: instance( |
850 | | - withDBClusterIdentifier(testDBClusterIdentifier), |
851 | | - withExternalName(testDBClusterIdentifier), |
852 | | - ), |
853 | | - }, |
854 | | - want: want{ |
855 | | - cr: instance( |
856 | | - withDBClusterIdentifier(testDBClusterIdentifier), |
857 | | - withDBSubnetGroup(testDBSubnetGroupName), |
858 | | - withExternalName(testDBClusterIdentifier), |
859 | | - withConditions(xpv1.Available()), |
860 | | - withStatus(svcapitypes.DocDBInstanceStateAvailable), |
861 | | - withStatusDBSubnetGroup(testDBSubnetGroupName), |
862 | | - withVpcSecurityGroupIds(), |
863 | | - ), |
864 | | - result: managed.ExternalObservation{ |
865 | | - ResourceExists: true, |
866 | | - ResourceUpToDate: true, |
867 | | - ResourceLateInitialized: true, |
868 | | - ConnectionDetails: generateConnectionDetails("", "", "", "", 0), |
869 | | - }, |
870 | | - docdb: fake.MockDocDBClientCall{ |
871 | | - DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{ |
872 | | - { |
873 | | - Ctx: context.Background(), |
874 | | - I: &docdb.DescribeDBClustersInput{ |
875 | | - DBClusterIdentifier: awsclient.String(testDBClusterIdentifier), |
876 | | - }, |
877 | | - }, |
878 | | - }, |
879 | | - ListTagsForResource: []*fake.CallListTagsForResource{ |
880 | | - { |
881 | | - I: &docdb.ListTagsForResourceInput{}, |
882 | | - }, |
883 | | - }, |
884 | | - }, |
885 | | - }, |
886 | | - }, |
887 | 714 | "AvailableState_and_changed_DeletionProtection_should_not_be_UpToDate": { |
888 | 715 | args: args{ |
889 | 716 | docdb: &fake.MockDocDBClient{ |
|
0 commit comments