Skip to content

Commit

Permalink
support change stream options pre and post images expire after
Browse files Browse the repository at this point in the history
  • Loading branch information
oarbusi committed Aug 26, 2024
1 parent 8f36ebd commit 169af75
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
23 changes: 12 additions & 11 deletions mongodbatlas/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,17 +178,18 @@ type Cluster struct {

// ProcessArgs represents the advanced configuration options for the cluster.
type ProcessArgs struct {
DefaultReadConcern string `json:"defaultReadConcern,omitempty"`
DefaultWriteConcern string `json:"defaultWriteConcern,omitempty"`
MinimumEnabledTLSProtocol string `json:"minimumEnabledTlsProtocol,omitempty"`
FailIndexKeyTooLong *bool `json:"failIndexKeyTooLong,omitempty"`
JavascriptEnabled *bool `json:"javascriptEnabled,omitempty"`
NoTableScan *bool `json:"noTableScan,omitempty"`
OplogSizeMB *int64 `json:"oplogSizeMB,omitempty"`
SampleSizeBIConnector *int64 `json:"sampleSizeBIConnector,omitempty"`
SampleRefreshIntervalBIConnector *int64 `json:"sampleRefreshIntervalBIConnector,omitempty"`
TransactionLifetimeLimitSeconds *int64 `json:"transactionLifetimeLimitSeconds,omitempty"`
OplogMinRetentionHours *float64 `json:"oplogMinRetentionHours,omitempty"`
DefaultReadConcern string `json:"defaultReadConcern,omitempty"`
DefaultWriteConcern string `json:"defaultWriteConcern,omitempty"`
MinimumEnabledTLSProtocol string `json:"minimumEnabledTlsProtocol,omitempty"`
FailIndexKeyTooLong *bool `json:"failIndexKeyTooLong,omitempty"`
JavascriptEnabled *bool `json:"javascriptEnabled,omitempty"`
NoTableScan *bool `json:"noTableScan,omitempty"`
OplogSizeMB *int64 `json:"oplogSizeMB,omitempty"`
SampleSizeBIConnector *int64 `json:"sampleSizeBIConnector,omitempty"`
SampleRefreshIntervalBIConnector *int64 `json:"sampleRefreshIntervalBIConnector,omitempty"`
TransactionLifetimeLimitSeconds *int64 `json:"transactionLifetimeLimitSeconds,omitempty"`
OplogMinRetentionHours *float64 `json:"oplogMinRetentionHours,omitempty"`
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds *int64 `json:"changeStreamOptionsPreAndPostImagesExpireAfterSeconds,omitempty"`
}

type Tag struct {
Expand Down
9 changes: 7 additions & 2 deletions mongodbatlas/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
SampleSizeBIConnector: pointer(int64(5000)),
SampleRefreshIntervalBIConnector: pointer(int64(300)),
TransactionLifetimeLimitSeconds: pointer(int64(30)),
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds: pointer(int64(-1)),
}

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/processArgs", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
Expand All @@ -799,6 +800,7 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
"sampleSizeBIConnector": float64(5000),
"sampleRefreshIntervalBIConnector": float64(300),
"transactionLifetimeLimitSeconds": float64(30),
"changeStreamOptionsPreAndPostImagesExpireAfterSeconds": float64(-1),
}

jsonBlob := `
Expand All @@ -813,7 +815,8 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
"oplogMinRetentionHours": 100,
"sampleSizeBIConnector": 5000,
"sampleRefreshIntervalBIConnector": 300,
"transactionLifetimeLimitSeconds": 30
"transactionLifetimeLimitSeconds": 30,
"changeStreamOptionsPreAndPostImagesExpireAfterSeconds": -1
}
`

Expand Down Expand Up @@ -862,7 +865,8 @@ func TestClusters_GetProcessArgs(t *testing.T) {
"oplogSizeMB": 2000,
"sampleSizeBIConnector": 5000,
"sampleRefreshIntervalBIConnector": 300,
"transactionLifetimeLimitSeconds": 30
"transactionLifetimeLimitSeconds": 30,
"ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds": 113
}`)
})

Expand All @@ -882,6 +886,7 @@ func TestClusters_GetProcessArgs(t *testing.T) {
SampleSizeBIConnector: pointer(int64(5000)),
SampleRefreshIntervalBIConnector: pointer(int64(300)),
TransactionLifetimeLimitSeconds: pointer(int64(30)),
ChangeStreamOptionsPreAndPostImagesExpireAfterSeconds: pointer(int64(113)),
}

if diff := deep.Equal(processArgs, expected); diff != nil {
Expand Down

0 comments on commit 169af75

Please sign in to comment.