Skip to content

Commit a8f9b16

Browse files
coderGo93Edgar Lopez
andauthored
INTMDB-252: added parameters default write for cluster advanced conf (#250)
Co-authored-by: Edgar Lopez <edgarlopez@pop-os.localdomain>
1 parent 9ae90b3 commit a8f9b16

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

mongodbatlas/clusters.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ type Cluster struct {
170170

171171
// ProcessArgs represents the advanced configuration options for the cluster.
172172
type ProcessArgs struct {
173+
DefaultReadConcern string `json:"defaultReadConcern,omitempty"`
174+
DefaultWriteConcern string `json:"defaultWriteConcern,omitempty"`
173175
FailIndexKeyTooLong *bool `json:"failIndexKeyTooLong,omitempty"`
174176
JavascriptEnabled *bool `json:"javascriptEnabled,omitempty"`
175177
MinimumEnabledTLSProtocol string `json:"minimumEnabledTlsProtocol,omitempty"`

mongodbatlas/clusters_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,12 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
723723
groupID := "1"
724724
clusterName := "AppData"
725725
tlsProtocol := "TLS1_2"
726+
defaultReadConcern := "available"
727+
defaultWriteConcern := "1"
726728

727729
updateRequest := &ProcessArgs{
730+
DefaultReadConcern: defaultReadConcern,
731+
DefaultWriteConcern: defaultWriteConcern,
728732
FailIndexKeyTooLong: pointy.Bool(false),
729733
JavascriptEnabled: pointy.Bool(false),
730734
MinimumEnabledTLSProtocol: tlsProtocol,
@@ -736,6 +740,8 @@ func TestClusters_UpdateProcessArgs(t *testing.T) {
736740

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

748754
jsonBlob := `
749755
{
756+
"defaultReadConcern": "available",
757+
"defaultWriteConcern": "1",
750758
"failIndexKeyTooLong": false,
751759
"javascriptEnabled": false,
752760
"minimumEnabledTlsProtocol": "TLS1_2",
@@ -796,6 +804,8 @@ func TestClusters_GetProcessArgs(t *testing.T) {
796804
mux.HandleFunc(fmt.Sprintf("/api/atlas/v1.0/groups/%s/clusters/%s/processArgs", groupID, clusterName), func(w http.ResponseWriter, r *http.Request) {
797805
testMethod(t, r, http.MethodGet)
798806
fmt.Fprint(w, `{
807+
"defaultReadConcern": "available",
808+
"defaultWriteConcern": "1",
799809
"failIndexKeyTooLong": false,
800810
"javascriptEnabled": false,
801811
"minimumEnabledTlsProtocol": "TLS1_2",
@@ -812,6 +822,8 @@ func TestClusters_GetProcessArgs(t *testing.T) {
812822
}
813823

814824
expected := &ProcessArgs{
825+
DefaultReadConcern: "available",
826+
DefaultWriteConcern: "1",
815827
FailIndexKeyTooLong: pointy.Bool(false),
816828
JavascriptEnabled: pointy.Bool(false),
817829
MinimumEnabledTLSProtocol: "TLS1_2",

0 commit comments

Comments
 (0)