Skip to content

Commit 0b490f1

Browse files
committed
Refactor .NET to use shared setup_test
1 parent 166e53d commit 0b490f1

2 files changed

Lines changed: 10 additions & 59 deletions

File tree

Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,18 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
# For others looking to analyze what this file does, it basically performs two steps.
5-
# The first step is creating an appropriate topology JSON file. You can see
6-
# the templates for .NET in the topologies directory. It rewrites the $schema and
7-
# include property so that the relative paths are correct for the destination
8-
# directory, adds a tag for the platform, and sets the CBL version to use in the
9-
# test server. Currently all of the tests that we are running use a single test
10-
# server, a single sync gateway, and a single Couchbase Server, and this will
11-
# be reflected in the topology file.
12-
#
13-
# The second step is to create a Topology instance from the resulting JSON file
14-
# and then pass that information, along with other basically hard coded info,
15-
# to the start_backend function which will handle the actual setup.
16-
17-
import json
4+
import click
185
import os
196
import sys
207
from pathlib import Path
218
from typing import Optional
229

23-
import click
24-
2510
SCRIPT_DIR = Path(os.path.dirname(os.path.realpath(__file__)))
2611
if __name__ == "__main__":
2712
sys.path.append(str(SCRIPT_DIR.parents[2]))
2813
sys.stdout.reconfigure(encoding="utf-8")
2914

30-
from environment.aws.start_backend import main as start_backend
31-
from environment.aws.topology_setup.setup_topology import TopologyConfig
32-
15+
from jenkins.pipelines.shared.setup_test import setup_test
3316

3417
@click.command()
3518
@click.argument("platform")
@@ -47,45 +30,15 @@ def cli_entry(
4730
sgw_version: str,
4831
private_key: Optional[str],
4932
) -> None:
50-
"""
51-
Sets up a .NET testing environment with the specified .NET platform, CBL version, dataset version, and Sync Gateway version.
52-
"""
53-
topology_file = str(
54-
SCRIPT_DIR.parents[2]
55-
/ "environment"
56-
/ "aws"
57-
/ "topology_setup"
58-
/ "topology.json"
59-
)
60-
with open(
61-
str(SCRIPT_DIR / "topologies" / f"topology_single_{platform}.json"), "r"
62-
) as fin:
63-
topology = json.load(fin)
64-
topology["$schema"] = "topology_schema.json"
65-
topology["include"] = "default_topology.json"
66-
topology["defaults"] = {
67-
"cbs": {
68-
"version": "7.6.4",
69-
},
70-
"sgw": {
71-
"version": sgw_version,
72-
},
73-
}
74-
topology["tag"] = f"dotnet_{platform}"
75-
topology["test_servers"][0]["cbl_version"] = cbl_version
76-
topology["test_servers"][0]["dataset_version"] = dataset_version
77-
with open(topology_file, "w") as fout:
78-
json.dump(topology, fout, indent=4)
79-
80-
topology = TopologyConfig(topology_file)
81-
start_backend(
82-
topology,
83-
"jborden",
84-
str(SCRIPT_DIR / "config_aws.json"),
85-
private_key=private_key,
86-
tdk_config_out=str(SCRIPT_DIR.parents[2] / "tests" / "dev_e2e" / "config.json"),
33+
setup_test(
34+
cbl_version,
35+
dataset_version,
36+
sgw_version,
37+
SCRIPT_DIR / "topologies" / f"topology_single_{platform}.json",
38+
SCRIPT_DIR / "config_aws.json",
39+
f"dotnet_{platform}",
40+
private_key,
8741
)
8842

89-
9043
if __name__ == "__main__":
9144
cli_entry()

jenkins/pipelines/dotnet/teardown.ps1

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
Import-Module $PSScriptRoot/prepare_env.psm1 -Force
2-
31
$env:PYTHONPATH = "$PSScriptRoot\..\..\..\"
42
Push-Location $PSScriptRoot\..\..\..\environment\aws
53
python -m venv venv

0 commit comments

Comments
 (0)