Skip to content

Commit

Permalink
fix(docdb/dbcluster): remove dbsubnetgroup isuptodate-check
Browse files Browse the repository at this point in the history
Signed-off-by: Charel Baum <[email protected]>
  • Loading branch information
Charel Baum committed Dec 21, 2022
1 parent b59bf42 commit 5407b50
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 174 deletions.
1 change: 0 additions & 1 deletion pkg/controller/docdb/dbcluster/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ func (e *hooks) isUpToDate(cr *svcapitypes.DBCluster, resp *svcsdk.DescribeDBClu
switch {
case awsclient.Int64Value(cr.Spec.ForProvider.BackupRetentionPeriod) != awsclient.Int64Value(cluster.BackupRetentionPeriod),
awsclient.StringValue(cr.Spec.ForProvider.DBClusterParameterGroupName) != awsclient.StringValue(cluster.DBClusterParameterGroup),
awsclient.StringValue(cr.Spec.ForProvider.DBSubnetGroupName) != awsclient.StringValue(cluster.DBSubnetGroup),
awsclient.BoolValue(cr.Spec.ForProvider.DeletionProtection) != awsclient.BoolValue(cluster.DeletionProtection),
!areSameElements(cr.Spec.ForProvider.EnableCloudwatchLogsExports, cluster.EnabledCloudwatchLogsExports),
awsclient.Int64Value(cr.Spec.ForProvider.Port) != awsclient.Int64Value(cluster.Port),
Expand Down
173 changes: 0 additions & 173 deletions pkg/controller/docdb/dbcluster/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ var (
testDBClusterParameterGroupName = "some-db-cluster-parameter-group"
testOtherDBClusterParameterGroupName = "some-other-db-cluster-parameter-group"
testDBSubnetGroupName = "some-db-subnet-group"
testOtherDBSubnetGroupName = "some-other-db-subnet-group"
testCloudWatchLog = "some-log"
testOtherCloudWatchLog = "some-other-log"
testEngine = "some-engine"
Expand Down Expand Up @@ -174,12 +173,6 @@ func withDBSubnetGroup(value string) docDBModifier {
}
}

func withStatusDBSubnetGroup(value string) docDBModifier {
return func(o *svcapitypes.DBCluster) {
o.Status.AtProvider.DBSubnetGroup = awsclient.String(value)
}
}

func withDeletionProtection(value bool) docDBModifier {
return func(o *svcapitypes.DBCluster) {
o.Spec.ForProvider.DeletionProtection = awsclient.Bool(value, awsclient.FieldRequired)
Expand Down Expand Up @@ -718,172 +711,6 @@ func TestObserve(t *testing.T) {
},
},
},
"AvailableState_and_changed_DBSubnetGroupName_should_not_be_UpToDate": {
args: args{
docdb: &fake.MockDocDBClient{
MockDescribeDBClustersWithContext: func(c context.Context, ddi *docdb.DescribeDBClustersInput, o []request.Option) (*docdb.DescribeDBClustersOutput, error) {
return &docdb.DescribeDBClustersOutput{
DBClusters: []*docdb.DBCluster{
{
DBClusterIdentifier: awsclient.String(testDBClusterIdentifier),
Status: awsclient.String(svcapitypes.DocDBInstanceStateAvailable),
DBSubnetGroup: awsclient.String(testDBSubnetGroupName),
},
},
}, nil
},
},
cr: instance(
withDBClusterIdentifier(testDBClusterIdentifier),
withExternalName(testDBClusterIdentifier),
withDBSubnetGroup(testOtherDBSubnetGroupName),
),
},
want: want{
cr: instance(
withDBClusterIdentifier(testDBClusterIdentifier),
withExternalName(testDBClusterIdentifier),
withConditions(xpv1.Available()),
withStatus(svcapitypes.DocDBInstanceStateAvailable),
withDBSubnetGroup(testOtherDBSubnetGroupName),
withStatusDBSubnetGroup(testDBSubnetGroupName),
withVpcSecurityGroupIds(),
),
result: managed.ExternalObservation{
ResourceExists: true,
ResourceUpToDate: false,
ResourceLateInitialized: true,
ConnectionDetails: generateConnectionDetails("", "", "", "", 0),
},
docdb: fake.MockDocDBClientCall{
DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{
{
Ctx: context.Background(),
I: &docdb.DescribeDBClustersInput{
DBClusterIdentifier: awsclient.String(testDBClusterIdentifier),
},
},
},
},
},
},
"AvailableState_and_same_DBSubnetGroupName_should_be_UpToDate": {
args: args{
docdb: &fake.MockDocDBClient{
MockDescribeDBClustersWithContext: func(c context.Context, ddi *docdb.DescribeDBClustersInput, o []request.Option) (*docdb.DescribeDBClustersOutput, error) {
return &docdb.DescribeDBClustersOutput{
DBClusters: []*docdb.DBCluster{
{
DBClusterIdentifier: awsclient.String(testDBClusterIdentifier),
Status: awsclient.String(svcapitypes.DocDBInstanceStateAvailable),
DBSubnetGroup: awsclient.String(testDBSubnetGroupName),
},
},
}, nil
},
MockListTagsForResource: func(ltfri *docdb.ListTagsForResourceInput) (*docdb.ListTagsForResourceOutput, error) {
return &docdb.ListTagsForResourceOutput{
TagList: []*docdb.Tag{},
}, nil
},
},
cr: instance(
withDBClusterIdentifier(testDBClusterIdentifier),
withExternalName(testDBClusterIdentifier),
withDBSubnetGroup(testDBSubnetGroupName),
),
},
want: want{
cr: instance(
withDBClusterIdentifier(testDBClusterIdentifier),
withExternalName(testDBClusterIdentifier),
withConditions(xpv1.Available()),
withStatus(svcapitypes.DocDBInstanceStateAvailable),
withDBSubnetGroup(testDBSubnetGroupName),
withStatusDBSubnetGroup(testDBSubnetGroupName),
withVpcSecurityGroupIds(),
),
result: managed.ExternalObservation{
ResourceExists: true,
ResourceUpToDate: true,
ResourceLateInitialized: true,
ConnectionDetails: generateConnectionDetails("", "", "", "", 0),
},
docdb: fake.MockDocDBClientCall{
DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{
{
Ctx: context.Background(),
I: &docdb.DescribeDBClustersInput{
DBClusterIdentifier: awsclient.String(testDBClusterIdentifier),
},
},
},
ListTagsForResource: []*fake.CallListTagsForResource{
{
I: &docdb.ListTagsForResourceInput{},
},
},
},
},
},
"AvailableState_and_no_spec_DBSubnetGroupName_should_be_UpToDate": {
args: args{
docdb: &fake.MockDocDBClient{
MockDescribeDBClustersWithContext: func(c context.Context, ddi *docdb.DescribeDBClustersInput, o []request.Option) (*docdb.DescribeDBClustersOutput, error) {
return &docdb.DescribeDBClustersOutput{
DBClusters: []*docdb.DBCluster{
{
DBClusterIdentifier: awsclient.String(testDBClusterIdentifier),
Status: awsclient.String(svcapitypes.DocDBInstanceStateAvailable),
DBSubnetGroup: awsclient.String(testDBSubnetGroupName),
},
},
}, nil
},
MockListTagsForResource: func(ltfri *docdb.ListTagsForResourceInput) (*docdb.ListTagsForResourceOutput, error) {
return &docdb.ListTagsForResourceOutput{
TagList: []*docdb.Tag{},
}, nil
},
},
cr: instance(
withDBClusterIdentifier(testDBClusterIdentifier),
withExternalName(testDBClusterIdentifier),
),
},
want: want{
cr: instance(
withDBClusterIdentifier(testDBClusterIdentifier),
withDBSubnetGroup(testDBSubnetGroupName),
withExternalName(testDBClusterIdentifier),
withConditions(xpv1.Available()),
withStatus(svcapitypes.DocDBInstanceStateAvailable),
withStatusDBSubnetGroup(testDBSubnetGroupName),
withVpcSecurityGroupIds(),
),
result: managed.ExternalObservation{
ResourceExists: true,
ResourceUpToDate: true,
ResourceLateInitialized: true,
ConnectionDetails: generateConnectionDetails("", "", "", "", 0),
},
docdb: fake.MockDocDBClientCall{
DescribeDBClustersWithContext: []*fake.CallDescribeDBClustersWithContext{
{
Ctx: context.Background(),
I: &docdb.DescribeDBClustersInput{
DBClusterIdentifier: awsclient.String(testDBClusterIdentifier),
},
},
},
ListTagsForResource: []*fake.CallListTagsForResource{
{
I: &docdb.ListTagsForResourceInput{},
},
},
},
},
},
"AvailableState_and_changed_DeletionProtection_should_not_be_UpToDate": {
args: args{
docdb: &fake.MockDocDBClient{
Expand Down

0 comments on commit 5407b50

Please sign in to comment.