Skip to content

Commit c44b2f7

Browse files
committed
Adding a unit test for OS2x to OS2x migration
Signed-off-by: Jugal Chauhan <[email protected]>
1 parent 63371ff commit c44b2f7

File tree

3 files changed

+269
-3
lines changed

3 files changed

+269
-3
lines changed

TrafficCapture/dockerSolution/src/main/docker/migrationConsole/lib/integ_test/integ_test/test_cases/backfill_tests.py

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,85 @@ def __init__(self, console_config_path: str, console_link_env: Environment, uniq
182182
def test_before(self):
183183
# Create a single index
184184
self.source_operations.create_index(cluster=self.source_cluster, index_name=self.index_name)
185-
self.source_operations.disable_bloom(cluster=self.source_cluster, index_name=self.index_name)
186-
self.source_operations.refresh(cluster=self.source_cluster, index_name=self.index_name)
185+
self.source_operations.get_index(cluster=self.source_cluster, index_name=self.index_name)
186+
187+
# Create a single document
188+
self.source_operations.create_document(
189+
cluster=self.source_cluster,
190+
index_name=self.index_name,
191+
doc_id=self.doc_id1
192+
)
193+
self.source_operations.get_document(
194+
cluster=self.source_cluster,
195+
index_name=self.index_name,
196+
doc_id=self.doc_id1
197+
)
198+
199+
# Create a single document
200+
self.source_operations.create_document(
201+
cluster=self.source_cluster,
202+
index_name=self.index_name,
203+
doc_id=self.doc_id2
204+
)
205+
self.source_operations.get_document(
206+
cluster=self.source_cluster,
207+
index_name=self.index_name,
208+
doc_id=self.doc_id2
209+
)
210+
211+
# Use no-op transformer
212+
noop_transform = self.source_operations.get_noop_transformation()
213+
self.source_operations.create_transformation_json_file(
214+
transform_config_data=[noop_transform],
215+
file_path_to_create=self.transform_config_file
216+
)
217+
218+
def metadata_migrate(self):
219+
metadata_result: CommandResult = self.metadata.migrate(
220+
extra_args=[
221+
"--transformer-config-file", self.transform_config_file,
222+
"--index-allowlist", self.index_name,
223+
"--component-template-allowlist", "none",
224+
"--index-template-allowlist", "none"
225+
]
226+
)
227+
assert metadata_result.success
228+
229+
def metadata_after(self):
230+
self.target_operations.get_index(
231+
cluster=self.target_cluster,
232+
index_name=self.index_name,
233+
max_attempts=5,
234+
delay=2.0
235+
)
236+
237+
def backfill_wait_for_stop(self):
238+
return super().backfill_wait_for_stop()
239+
240+
241+
242+
class Test0009OS2TestsWithBestCompression(MATestBase):
243+
def __init__(self, console_config_path: str, console_link_env: Environment, unique_id: str):
244+
allow_combinations = [
245+
(ElasticsearchV2_X, OpensearchV2_X)
246+
]
247+
run_isolated = True
248+
description = "For ES 8x test using 2 simple docs in 1 index to perform metadata and backfill."
249+
super().__init__(console_config_path=console_config_path,
250+
console_link_env=console_link_env,
251+
unique_id=unique_id,
252+
description=description,
253+
allow_source_target_combinations=allow_combinations,
254+
migrations_required=[MigrationType.BACKFILL, MigrationType.METADATA],
255+
run_isolated=run_isolated)
256+
self.transform_config_file = "/shared-logs-output/test-transformations/transformation.json"
257+
self.index_name = f"test_0010_{self.unique_id}"
258+
self.doc_id1 = "test_1000_doc"
259+
self.doc_id2 = "test_2000_doc"
260+
261+
def test_before(self):
262+
# Create a single index
263+
self.source_operations.create_index(cluster=self.source_cluster, index_name=self.index_name)
187264
self.source_operations.get_index(cluster=self.source_cluster, index_name=self.index_name)
188265

189266
# Create a single document
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
conditionalPackageInstalls:
2+
bulkLoader: true
3+
grafana: false
4+
jaeger: false
5+
kafka: true
6+
migrationConsole: true
7+
prometheus: false
8+
proxy: true
9+
replayer: true
10+
sharedConfigs: true
11+
snapshotVolume: true
12+
logsVolume: true
13+
14+
shared-configs:
15+
globalParameters:
16+
sourceCluster:
17+
allowRuntimeOverride: true
18+
object:
19+
endpoint: "http://opensearch-source:9200"
20+
directEndpoint: "http://opensearch-source:9200"
21+
allowInsecure: true
22+
authType: "basic_auth"
23+
basicAuthUsername: "admin"
24+
basicAuthPassword: "myStrongPassword123!"
25+
basicAuthHeader: "Basic YWRtaW46bXlTdHJvbmdQYXNzd29yZDEyMyE="
26+
version: "OS_2.19"
27+
targetCluster:
28+
allowRuntimeOverride: true
29+
object:
30+
endpoint: "https://opensearch-cluster-master:9200"
31+
allowInsecure: true
32+
authType: "basic_auth"
33+
basicAuthUsername: "admin"
34+
basicAuthPassword: "myStrongPassword123!"
35+
basicAuthHeader: "Basic YWRtaW46bXlTdHJvbmdQYXNzd29yZDEyMyE="
36+
version: "OS_2.19"
37+
kafkaBrokers:
38+
allowRuntimeOverride: false
39+
object:
40+
brokers: "captured-traffic-kafka-bootstrap.ma.svc:9092"
41+
kafkaType: "standard"
42+
snapshot:
43+
allowRuntimeOverride: true
44+
object:
45+
repoPath: "/snapshot"
46+
snapshotName: "migration-assistant-snapshot"
47+
snapshotType: "fs"
48+
metadataMigration:
49+
allowRuntimeOverride: true
50+
object:
51+
clusterAwarenessAttributes: 1
52+
metadataType: "from_snapshot"
53+
sourceClusterVersion: "OS_2.19"
54+
55+
capture-proxy:
56+
parameters:
57+
destinationUri:
58+
source: otherConfig
59+
configMapName: "source-cluster"
60+
configMapKey: "directEndpoint"
61+
insecureDestination:
62+
source: otherConfig
63+
configMapName: "source-cluster"
64+
configMapKey: "allowInsecure"
65+
kafkaConnection:
66+
source: otherConfig
67+
configMapName: "kafka-brokers"
68+
configMapKey: "brokers"
69+
70+
migration-console:
71+
snapshotVolumeEnabled: true
72+
snapshotVolumePvc: "snapshot-volume-pvc"
73+
sharedLogsVolumeEnabled: true
74+
sharedLogsPvc: "shared-logs-pvc"
75+
76+
bulk-document-loader:
77+
snapshotVolumeEnabled: true
78+
snapshotVolumePvc: "snapshot-volume-pvc"
79+
sharedLogsVolumeEnabled: true
80+
sharedLogsPvc: "shared-logs-pvc"
81+
parameters:
82+
snapshotName:
83+
source: otherConfig
84+
configMapName: "snapshot"
85+
configMapKey: "snapshotName"
86+
targetHost:
87+
source: otherConfig
88+
configMapName: "target-cluster"
89+
configMapKey: "endpoint"
90+
targetInsecure:
91+
source: otherConfig
92+
configMapName: "target-cluster"
93+
configMapKey: "allowInsecure"
94+
parameterType: booleanFlag
95+
targetUsername:
96+
source: otherConfig
97+
configMapName: "target-cluster"
98+
configMapKey: "basicAuthUsername"
99+
targetPassword:
100+
source: otherConfig
101+
configMapName: "target-cluster"
102+
configMapKey: "basicAuthPassword"
103+
sourceVersion:
104+
source: otherConfig
105+
configMapName: "source-cluster"
106+
configMapKey: "version"
107+
docTransformerConfigFile:
108+
source: parameterConfig
109+
value: "/shared-logs-output/test-transformations/transformation.json"
110+
allowRuntimeOverride: true
111+
112+
replayer:
113+
sharedLogsVolumeEnabled: true
114+
sharedLogsPvc: "shared-logs-pvc"
115+
parameters:
116+
kafkaTrafficBrokers:
117+
source: otherConfig
118+
configMapName: "kafka-brokers"
119+
configMapKey: "brokers"
120+
targetUri:
121+
source: otherConfig
122+
configMapName: "target-cluster"
123+
configMapKey: "endpoint"
124+
insecure:
125+
source: otherConfig
126+
configMapName: "target-cluster"
127+
configMapKey: "allowInsecure"
128+
parameterType: booleanFlag
129+
authHeaderValue:
130+
source: otherConfig
131+
configMapName: "target-cluster"
132+
configMapKey: "basicAuthHeader"
133+
speedupFactor:
134+
source: parameterConfig
135+
value: 10
136+
allowRuntimeOverride: true
137+
transformerConfigFile:
138+
source: parameterConfig
139+
value: "/shared-logs-output/test-transformations/transformation.json"
140+
allowRuntimeOverride: true
141+
142+
captured-traffic-kafka-cluster:
143+
environment: test
144+
clusterName: captured-traffic
145+
replicas: 1
146+
storageType: ephemeral
147+
storageSize: 100Gi
148+
storageDeleteClaim: true
149+
dedicatedController:
150+
replicas: 1
151+
storageSize: 10Gi
152+
153+
jaeger:
154+
allInOne:
155+
enabled: true
156+
provisionDataStore:
157+
cassandra: false
158+
storage:
159+
type: memory
160+
agent:
161+
enabled: false
162+
collector:
163+
enabled: false
164+
query:
165+
enabled: false
166+
167+
grafana:
168+
datasources:
169+
datasources.yaml:
170+
apiVersion: 1
171+
datasources:
172+
- name: Prometheus
173+
type: prometheus
174+
access: proxy
175+
url: http://prometheus-server.prometheus.svc.cluster.local:9090
176+
isDefault: true
177+
editable: true
178+
- name: Jaeger
179+
type: jaeger
180+
access: proxy
181+
url: http://jaeger-query.jaeger.svc.cluster.local:16686
182+
isDefault: false
183+
editable: true
184+
sidecar:
185+
datasources:
186+
enabled: true
187+
dashboards:
188+
enabled: true
189+
label: grafana_dashboard

libraries/testAutomation/testAutomation/test_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
logging.basicConfig(format='%(asctime)s [%(levelname)s] %(message)s', level=logging.INFO)
1414
logger = logging.getLogger(__name__)
1515

16-
VALID_SOURCE_VERSIONS = ["ES_5.6", "ES_8.x"]
16+
VALID_SOURCE_VERSIONS = ["ES_5.6", "ES_8.x", "OS_2.x"]
1717
VALID_TARGET_VERSIONS = ["OS_2.x"]
1818
SOURCE_RELEASE_NAME = "source"
1919
TARGET_RELEASE_NAME = "target"

0 commit comments

Comments
 (0)