Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.

Commit 099f18d

Browse files
authored
Merge pull request crossplane-contrib#1607 from wotolom/docdb-wrong-isuptodate-check
2 parents b59bf42 + 5407b50 commit 099f18d

File tree

2 files changed

+0
-174
lines changed

2 files changed

+0
-174
lines changed

pkg/controller/docdb/dbcluster/setup.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ func (e *hooks) isUpToDate(cr *svcapitypes.DBCluster, resp *svcsdk.DescribeDBClu
162162
switch {
163163
case awsclient.Int64Value(cr.Spec.ForProvider.BackupRetentionPeriod) != awsclient.Int64Value(cluster.BackupRetentionPeriod),
164164
awsclient.StringValue(cr.Spec.ForProvider.DBClusterParameterGroupName) != awsclient.StringValue(cluster.DBClusterParameterGroup),
165-
awsclient.StringValue(cr.Spec.ForProvider.DBSubnetGroupName) != awsclient.StringValue(cluster.DBSubnetGroup),
166165
awsclient.BoolValue(cr.Spec.ForProvider.DeletionProtection) != awsclient.BoolValue(cluster.DeletionProtection),
167166
!areSameElements(cr.Spec.ForProvider.EnableCloudwatchLogsExports, cluster.EnabledCloudwatchLogsExports),
168167
awsclient.Int64Value(cr.Spec.ForProvider.Port) != awsclient.Int64Value(cluster.Port),

pkg/controller/docdb/dbcluster/setup_test.go

Lines changed: 0 additions & 173 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ var (
5151
testDBClusterParameterGroupName = "some-db-cluster-parameter-group"
5252
testOtherDBClusterParameterGroupName = "some-other-db-cluster-parameter-group"
5353
testDBSubnetGroupName = "some-db-subnet-group"
54-
testOtherDBSubnetGroupName = "some-other-db-subnet-group"
5554
testCloudWatchLog = "some-log"
5655
testOtherCloudWatchLog = "some-other-log"
5756
testEngine = "some-engine"
@@ -174,12 +173,6 @@ func withDBSubnetGroup(value string) docDBModifier {
174173
}
175174
}
176175

177-
func withStatusDBSubnetGroup(value string) docDBModifier {
178-
return func(o *svcapitypes.DBCluster) {
179-
o.Status.AtProvider.DBSubnetGroup = awsclient.String(value)
180-
}
181-
}
182-
183176
func withDeletionProtection(value bool) docDBModifier {
184177
return func(o *svcapitypes.DBCluster) {
185178
o.Spec.ForProvider.DeletionProtection = awsclient.Bool(value, awsclient.FieldRequired)
@@ -718,172 +711,6 @@ func TestObserve(t *testing.T) {
718711
},
719712
},
720713
},
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-
},
887714
"AvailableState_and_changed_DeletionProtection_should_not_be_UpToDate": {
888715
args: args{
889716
docdb: &fake.MockDocDBClient{

0 commit comments

Comments
 (0)