You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: Adjust tests creating free tier cluster to have dedicated project (#3596)
* adjust tests creating free tier cluster to have dedicated project
* adding comment
* refactor ProjectIDExecutionWithCluster to contemplate restriction of free tier clusters
* separate function to avoid making ProjectIDExecutionWithCluster more complex
// When `MONGODB_ATLAS_PROJECT_ID` is defined, it is used instead of creating a project. This is useful for local execution but not intended for CI executions.
Copy file name to clipboardExpand all lines: internal/testutil/acc/shared_resource.go
+23-12Lines changed: 23 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ import (
15
15
16
16
const (
17
17
MaxClusterNodesPerProject=30// Choose to be conservative, 40 clusters per project is the limit before `CROSS_REGION_NETWORK_PERMISSIONS_LIMIT_EXCEEDED` error, see https://www.mongodb.com/docs/atlas/reference/atlas-limits/
18
+
MaxFreeTierClusterCount=1// Project can have at most 1 free tier cluster
18
19
)
19
20
20
21
// SetupSharedResources must be called from TestMain test package in order to use ProjectIDExecution.
// ProjectIDExecutionWithCluster creates a project and reuses it with other tests respecting `MaxClusterNodesPerProject` restrictions. The clusterName is always unique.
98
+
// TotalNodeCount = sum(specs.node_count) * num_shards (1 if new schema)
99
+
// This avoids `CROSS_REGION_NETWORK_PERMISSIONS_LIMIT_EXCEEDED` and `project has reached the limit for the number of free clusters` errors when creating too many clusters within the same project.
100
+
// When `MONGODB_ATLAS_PROJECT_ID` and `MONGODB_ATLAS_CLUSTER_NAME` are defined, they are used instead of creating a project and clusterName.
// ClusterNameExecution returns the name of a created cluster for the execution of the tests in the resource package.
100
107
// This function relies on using an execution project and returns its id.
101
108
// When `MONGODB_ATLAS_CLUSTER_NAME` and `MONGODB_ATLAS_PROJECT_ID` are defined it will be used instead of creating resources. This is useful for local execution but not intended for CI executions.
// NextProjectIDClusterName is an internal method used when we want to reuse a projectID respecting `MaxClustersNodesPerProject` and `MaxFreeTierClusterCount`
0 commit comments