@@ -792,3 +792,95 @@ func TestSubscription_DeleteVPCPeering(t *testing.T) {
792
792
err = subject .Subscription .DeleteVPCPeering (context .TODO (), 2 , 20 )
793
793
require .NoError (t , err )
794
794
}
795
+
796
+ func TestSubscription_ListActiveActiveRegions (t * testing.T ) {
797
+ s := httptest .NewServer (testServer ("apiKey" , "secret" , getRequest (t , "/subscriptions/1986/regions" ,
798
+ `
799
+ {
800
+ "subscriptionId": 1986,
801
+ "regions": [
802
+ {
803
+ "regionId": 12,
804
+ "region": "us-east-1",
805
+ "deploymentCidr": "192.169.0.0/24",
806
+ "vpcId": "vpc-0e828cd5c0c580389",
807
+ "databases": [
808
+ {
809
+ "databaseId": 645,
810
+ "databaseName": "database-name",
811
+ "readOperationsPerSecond": 1000,
812
+ "writeOperationsPerSecond": 1000,
813
+ "respVersion": "resp3",
814
+ "links": []
815
+ }
816
+ ],
817
+ "links": []
818
+ },
819
+ {
820
+ "regionId": 19,
821
+ "region": "us-east-2",
822
+ "deploymentCidr": "11.0.1.0/24",
823
+ "vpcId": "vpc-0aecab539b31057a5",
824
+ "databases": [
825
+ {
826
+ "databaseId": 645,
827
+ "databaseName": "database-name",
828
+ "readOperationsPerSecond": 1000,
829
+ "writeOperationsPerSecond": 1000,
830
+ "respVersion": "resp3",
831
+ "links": []
832
+ }
833
+ ],
834
+ "links": []
835
+ }
836
+ ],
837
+ "links": [
838
+ {
839
+ "href": "https://api-staging.qa.redislabs.com/v1/subscriptions/118802/regions",
840
+ "type": "GET",
841
+ "rel": "self"
842
+ }
843
+ ]
844
+ }
845
+ ` )))
846
+
847
+ subject , err := clientFromTestServer (s , "apiKey" , "secret" )
848
+ require .NoError (t , err )
849
+
850
+ actual , err := subject .Subscription .ListActiveActiveRegions (context .TODO (), 1986 )
851
+ require .NoError (t , err )
852
+
853
+ var expected = listRegionsExpected ()
854
+ assert .Equal (t , expected , actual )
855
+
856
+ }
857
+
858
+ func listRegionsExpected () []* subscriptions.ActiveActiveRegion {
859
+
860
+ // Initialize databases
861
+ database := subscriptions.ActiveActiveDatabase {
862
+ DatabaseId : redis .Int (645 ),
863
+ DatabaseName : redis .String ("database-name" ),
864
+ ReadOperationsPerSecond : redis .Int (1000 ),
865
+ WriteOperationsPerSecond : redis .Int (1000 ),
866
+ }
867
+
868
+ // Initialize regions
869
+ region1Struct := & subscriptions.ActiveActiveRegion {
870
+ RegionId : redis .Int (12 ),
871
+ Region : redis .String ("us-east-1" ),
872
+ DeploymentCIDR : redis .String ("192.169.0.0/24" ),
873
+ VpcId : redis .String ("vpc-0e828cd5c0c580389" ),
874
+ Databases : []subscriptions.ActiveActiveDatabase {database },
875
+ }
876
+
877
+ region2Struct := & subscriptions.ActiveActiveRegion {
878
+ RegionId : redis .Int (19 ),
879
+ Region : redis .String ("us-east-2" ),
880
+ DeploymentCIDR : redis .String ("11.0.1.0/24" ),
881
+ VpcId : redis .String ("vpc-0aecab539b31057a5" ),
882
+ Databases : []subscriptions.ActiveActiveDatabase {database },
883
+ }
884
+
885
+ return []* subscriptions.ActiveActiveRegion {region1Struct , region2Struct }
886
+ }
0 commit comments