@@ -96,6 +96,89 @@ func TestFixedDatabase_Create(t *testing.T) {
9696 assert .Equal (t , 51055029 , actual )
9797}
9898
99+ func TestFixedDatabase_Create_with_RedisVersion (t * testing.T ) {
100+ server := httptest .NewServer (
101+ testServer (
102+ "apiKey" ,
103+ "secret" ,
104+ postRequest (
105+ t ,
106+ "/fixed/subscriptions/111728/databases" ,
107+ `{
108+ "name": "my-redis-essentials-db",
109+ "protocol": "redis",
110+ "redisVersion": "7.4",
111+ "dataPersistence": "none",
112+ "dataEvictionPolicy": "noeviction",
113+ "replication": false,
114+ "alerts": []
115+ }` ,
116+ `{
117+ "taskId": "784299af-17ea-4ed6-b08f-dd643238c8dd",
118+ "commandType": "fixedDatabaseCreateRequest",
119+ "status": "received",
120+ "description": "Task request received and is being queued for processing.",
121+ "timestamp": "2024-05-10T14:14:14.736763484Z",
122+ "links": [
123+ {
124+ "rel": "task",
125+ "type": "GET",
126+ "href": "https://api-staging.qa.redislabs.com/v1/tasks/784299af-17ea-4ed6-b08f-dd643238c8dd"
127+ }
128+ ]
129+ }` ,
130+ ),
131+ getRequest (
132+ t ,
133+ "/tasks/784299af-17ea-4ed6-b08f-dd643238c8dd" ,
134+ `{
135+ "taskId": "784299af-17ea-4ed6-b08f-dd643238c8dd",
136+ "commandType": "fixedDatabaseCreateRequest",
137+ "status": "processing-completed",
138+ "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.",
139+ "timestamp": "2024-05-10T14:14:34.153537279Z",
140+ "response": {
141+ "resourceId": 51055030,
142+ "additionalResourceId": 111728
143+ },
144+ "links": [
145+ {
146+ "rel": "resource",
147+ "type": "GET",
148+ "href": "https://api-staging.qa.redislabs.com/v1/fixed/subscriptions/111728/databases/51055030"
149+ },
150+ {
151+ "rel": "self",
152+ "type": "GET",
153+ "href": "https://api-staging.qa.redislabs.com/v1/tasks/784299af-17ea-4ed6-b08f-dd643238c8dd"
154+ }
155+ ]
156+ }` ,
157+ ),
158+ ),
159+ )
160+
161+ subject , err := clientFromTestServer (server , "apiKey" , "secret" )
162+ require .NoError (t , err )
163+
164+ actual , err := subject .FixedDatabases .Create (
165+ context .TODO (),
166+ 111728 ,
167+ fixedDatabases.CreateFixedDatabase {
168+ Name : redis .String ("my-redis-essentials-db" ),
169+ Protocol : redis .String ("redis" ),
170+ RedisVersion : redis .String ("7.4" ),
171+ DataPersistence : redis .String ("none" ),
172+ DataEvictionPolicy : redis .String ("noeviction" ),
173+ Replication : redis .Bool (false ),
174+ Alerts : & []* databases.Alert {},
175+ },
176+ )
177+
178+ require .NoError (t , err )
179+ assert .Equal (t , 51055030 , actual )
180+ }
181+
99182func TestFixedDatabase_List (t * testing.T ) {
100183 server := httptest .NewServer (
101184 testServer (
@@ -546,3 +629,67 @@ func TestFixedDatabase_Delete(t *testing.T) {
546629 require .NoError (t , err )
547630
548631}
632+
633+ func TestFixedDatabase_UpgradeRedisVersion (t * testing.T ) {
634+ server := httptest .NewServer (
635+ testServer (
636+ "apiKey" ,
637+ "secret" ,
638+ postRequest (
639+ t ,
640+ "/fixed/subscriptions/112119/databases/51056892/upgrade" ,
641+ `{ "targetRedisVersion": "7.4" }` ,
642+ `{
643+ "taskId": "upgrade-task-uuid",
644+ "commandType": "fixedDatabaseUpgradeRequest",
645+ "status": "received",
646+ "description": "Task request received and is being queued for processing.",
647+ "timestamp": "2024-05-15T14:55:04.008723915Z",
648+ "links": [
649+ {
650+ "rel": "task",
651+ "type": "GET",
652+ "href": "https://api-staging.qa.redislabs.com/v1/tasks/upgrade-task-uuid"
653+ }
654+ ]
655+ }` ,
656+ ),
657+ getRequest (
658+ t ,
659+ "/tasks/upgrade-task-uuid" ,
660+ `{
661+ "taskId": "upgrade-task-uuid",
662+ "commandType": "fixedDatabaseUpgradeRequest",
663+ "status": "processing-completed",
664+ "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.",
665+ "timestamp": "2024-05-15T14:55:06.538386979Z",
666+ "response": {
667+ "resourceId": 51056892,
668+ "additionalResourceId": 112119
669+ },
670+ "links": [
671+ {
672+ "rel": "self",
673+ "type": "GET",
674+ "href": "https://api-staging.qa.redislabs.com/v1/tasks/upgrade-task-uuid"
675+ }
676+ ]
677+ }` ,
678+ ),
679+ ),
680+ )
681+
682+ subject , err := clientFromTestServer (server , "apiKey" , "secret" )
683+ require .NoError (t , err )
684+
685+ err = subject .FixedDatabases .UpgradeRedisVersion (
686+ context .TODO (),
687+ 112119 ,
688+ 51056892 ,
689+ fixedDatabases.UpgradeFixedDatabaseRedisVersion {
690+ TargetRedisVersion : redis .String ("7.4" ),
691+ },
692+ )
693+
694+ require .NoError (t , err )
695+ }
0 commit comments