Skip to content

Commit

Permalink
INTMDB-252: added parameters default write for cluster advanced conf (#…
Browse files Browse the repository at this point in the history
…250)

Co-authored-by: Edgar Lopez <[email protected]>
  • Loading branch information
coderGo93 and Edgar Lopez authored Sep 8, 2021
1 parent 9ae90b3 commit a8f9b16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mongodbatlas/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ 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"`
FailIndexKeyTooLong *bool `json:"failIndexKeyTooLong,omitempty"`
JavascriptEnabled *bool `json:"javascriptEnabled,omitempty"`
MinimumEnabledTLSProtocol string `json:"minimumEnabledTlsProtocol,omitempty"`
Expand Down
12 changes: 12 additions & 0 deletions mongodbatlas/clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,12 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
groupID := "1"
clusterName := "AppData"
tlsProtocol := "TLS1_2"
defaultReadConcern := "available"
defaultWriteConcern := "1"

updateRequest := &ProcessArgs{
DefaultReadConcern: defaultReadConcern,
DefaultWriteConcern: defaultWriteConcern,
FailIndexKeyTooLong: pointy.Bool(false),
JavascriptEnabled: pointy.Bool(false),
MinimumEnabledTLSProtocol: tlsProtocol,
Expand All @@ -736,6 +740,8 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {

mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/processArgs", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
expected := map[string]interface{}{
"defaultReadConcern": defaultReadConcern,
"defaultWriteConcern": defaultWriteConcern,
"failIndexKeyTooLong": false,
"javascriptEnabled": false,
"minimumEnabledTlsProtocol": tlsProtocol,
Expand All @@ -747,6 +753,8 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {

jsonBlob := `
{
"defaultReadConcern": "available",
"defaultWriteConcern": "1",
"failIndexKeyTooLong": false,
"javascriptEnabled": false,
"minimumEnabledTlsProtocol": "TLS1_2",
Expand Down Expand Up @@ -796,6 +804,8 @@ func TestClusters_GetProcessArgs(t *testing.T) {
mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/processArgs", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, http.MethodGet)
fmt.Fprint(w, `{
"defaultReadConcern": "available",
"defaultWriteConcern": "1",
"failIndexKeyTooLong": false,
"javascriptEnabled": false,
"minimumEnabledTlsProtocol": "TLS1_2",
Expand All @@ -812,6 +822,8 @@ func TestClusters_GetProcessArgs(t *testing.T) {
}

expected := &ProcessArgs{
DefaultReadConcern: "available",
DefaultWriteConcern: "1",
FailIndexKeyTooLong: pointy.Bool(false),
JavascriptEnabled: pointy.Bool(false),
MinimumEnabledTLSProtocol: "TLS1_2",
Expand Down

0 comments on commit a8f9b16

Please sign in to comment.