Skip to content

Commit 26a1c9a

Browse files
committed
Declarative Tests for Scaling
Declarative tests for ScaleUpAndDown.
1 parent d3a3ba8 commit 26a1c9a

File tree

7 files changed

+182
-6
lines changed

7 files changed

+182
-6
lines changed

pkg/resource/replication_group/custom_set_output.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ func (rm *resourceManager) CustomModifyReplicationGroupSetOutput(
7676
}
7777
ko.Spec.LogDeliveryConfigurations = logDeliveryConfig
7878

79+
// Keep the value of desired for CacheNodeType.
80+
ko.Spec.CacheNodeType = r.ko.Spec.CacheNodeType
81+
7982
rm.setAnnotationsFields(r, ko)
8083
return ko, nil
8184
}

test/e2e/declarative_test_fwk/loader.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
from e2e.declarative_test_fwk import model
1818
import pytest
1919
import os
20+
import glob
2021
from typing import Iterable, List
2122
from pathlib import Path
22-
from os.path import isfile, join
23+
from os.path import isfile, join, isdir
2324
from acktest.resources import load_resource_file, random_suffix_name
2425

2526

@@ -34,11 +35,11 @@ def list_scenarios(scenarios_directory: Path) -> Iterable:
3435
"""
3536

3637
scenarios_list = []
37-
for scenario_file in sorted(os.listdir(scenarios_directory)):
38-
scenario_file_full_path = join(scenarios_directory, scenario_file)
39-
if not isfile(scenario_file_full_path) or not scenario_file.endswith(".yaml"):
40-
continue
41-
scenarios_list.append(pytest.param(Path(scenario_file_full_path), marks=marks(Path(scenario_file_full_path))))
38+
scenario_files = glob.glob(str(scenarios_directory) + "/**/*.yaml", recursive=True)
39+
40+
for scenario_file in scenario_files:
41+
scenarios_list.append(pytest.param(Path(scenario_file), marks=marks(Path(scenario_file))))
42+
4243
return scenarios_list
4344

4445

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
id: "CMD_SCALE_DOWN"
2+
description: "Scale down CMD"
3+
resource:
4+
apiVersion: $CRD_GROUP/$CRD_VERSION
5+
kind: ReplicationGroup
6+
metadata:
7+
name: test$RANDOM_SUFFIX
8+
steps:
9+
- id: "create_CMD_replication_group"
10+
description: "Initial config"
11+
create:
12+
spec:
13+
engine: redis
14+
replicationGroupID: test$RANDOM_SUFFIX
15+
replicationGroupDescription: Scale down for CMD
16+
cacheNodeType: cache.t3.medium
17+
numNodeGroups: 1
18+
wait:
19+
status:
20+
conditions:
21+
ACK.ResourceSynced:
22+
status: "True"
23+
timeout: 2800
24+
expect:
25+
status:
26+
status: "available"
27+
- id: "scale_down"
28+
description: "Scale down to t3.micro"
29+
patch:
30+
spec:
31+
cacheNodeType: cache.t3.micro
32+
wait:
33+
status:
34+
conditions:
35+
ACK.ResourceSynced:
36+
status: "True"
37+
timeout: 5000
38+
expect:
39+
status:
40+
status: "available"
41+
- id: "delete_CMD_RG"
42+
description: "Delete cluster mode disabled replication group"
43+
delete: test$RANDOM_SUFFIX
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
id: "CMD_SCALE_UP"
2+
description: "Scale up CMD"
3+
resource:
4+
apiVersion: $CRD_GROUP/$CRD_VERSION
5+
kind: ReplicationGroup
6+
metadata:
7+
name: test$RANDOM_SUFFIX
8+
steps:
9+
- id: "create_CMD_replication_group"
10+
description: "Initial config"
11+
create:
12+
spec:
13+
engine: redis
14+
replicationGroupID: test$RANDOM_SUFFIX
15+
replicationGroupDescription: Scale up for CMD
16+
cacheNodeType: cache.t3.micro
17+
numNodeGroups: 1
18+
wait:
19+
status:
20+
conditions:
21+
ACK.ResourceSynced:
22+
status: "True"
23+
timeout: 1800
24+
expect:
25+
status:
26+
status: "available"
27+
- id: "scale_up"
28+
description: "Scale up from t3.micro to t3.medium"
29+
patch:
30+
spec:
31+
cacheNodeType: cache.t3.medium
32+
wait:
33+
status:
34+
conditions:
35+
ACK.ResourceSynced:
36+
status: "True"
37+
timeout: 5000
38+
expect:
39+
status:
40+
status: "available"
41+
- id: "delete_CMD_RG"
42+
description: "Delete cluster mode disabled replication group"
43+
delete: test$RANDOM_SUFFIX
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
id: "CME_SCALE_DOWN"
2+
description: "Scale Down CME"
3+
resource:
4+
apiVersion: $CRD_GROUP/$CRD_VERSION
5+
kind: ReplicationGroup
6+
metadata:
7+
name: test$RANDOM_SUFFIX
8+
steps:
9+
- id: "create_CMD_replication_group"
10+
description: "Initial config"
11+
create:
12+
spec:
13+
engine: redis
14+
replicationGroupID: test$RANDOM_SUFFIX
15+
replicationGroupDescription: Scale down CME
16+
cacheNodeType: cache.t3.medium
17+
numNodeGroups: 2
18+
wait:
19+
status:
20+
conditions:
21+
ACK.ResourceSynced:
22+
status: "True"
23+
timeout: 1800
24+
expect:
25+
status:
26+
status: "available"
27+
- id: "scale_down"
28+
description: "Scale down from t3.medium to t3.micro"
29+
patch:
30+
spec:
31+
cacheNodeType: cache.t3.micro
32+
wait:
33+
status:
34+
conditions:
35+
ACK.ResourceSynced:
36+
status: "True"
37+
timeout: 5000
38+
expect:
39+
status:
40+
status: "available"
41+
- id: "delete_CMD_RG"
42+
description: "Delete cluster mode disabled replication group"
43+
delete: test$RANDOM_SUFFIX
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
id: "CME_SCALE_UP"
2+
description: "Scale Up CME"
3+
resource:
4+
apiVersion: $CRD_GROUP/$CRD_VERSION
5+
kind: ReplicationGroup
6+
metadata:
7+
name: test$RANDOM_SUFFIX
8+
steps:
9+
- id: "create_CMD_replication_group"
10+
description: "Initial config"
11+
create:
12+
spec:
13+
engine: redis
14+
replicationGroupID: test$RANDOM_SUFFIX
15+
replicationGroupDescription: Scale Up CME
16+
cacheNodeType: cache.t3.micro
17+
numNodeGroups: 2
18+
wait:
19+
status:
20+
conditions:
21+
ACK.ResourceSynced:
22+
status: "True"
23+
timeout: 1800
24+
expect:
25+
status:
26+
status: "available"
27+
- id: "scale_up"
28+
description: "Scale up from t3.micro to t3.medium"
29+
patch:
30+
spec:
31+
cacheNodeType: cache.t3.medium
32+
wait:
33+
status:
34+
conditions:
35+
ACK.ResourceSynced:
36+
status: "True"
37+
timeout: 5000
38+
expect:
39+
status:
40+
status: "available"
41+
- id: "delete_CMD_RG"
42+
description: "Delete cluster mode disabled replication group"
43+
delete: test$RANDOM_SUFFIX

0 commit comments

Comments
 (0)