Skip to content

Commit 95c9659

Browse files
committed
revert(aws_mock): remove aws_mock, moto based tested replaces it
since we have replacement for the tests using this mock, we remove all the code related to it
1 parent e11124d commit 95c9659

File tree

8 files changed

+5
-285
lines changed

8 files changed

+5
-285
lines changed

Jenkinsfile

-18
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,6 @@ pipeline {
138138
}
139139
}
140140
}
141-
stage("run mocked tests") {
142-
options {
143-
timeout(time: 10, unit: 'MINUTES')
144-
}
145-
steps {
146-
script {
147-
try {
148-
sh ''' ./docker/env/hydra.sh run-aws-mock -r us-east-1 '''
149-
sleep 10 // seconds
150-
sh ''' ./docker/env/hydra.sh --aws-mock run-pytest functional_tests/mocked '''
151-
pullRequestSetResult('success', 'jenkins/mocked_tests', 'All mocked tests are passed')
152-
} catch(Exception ex) {
153-
pullRequestSetResult('failure', 'jenkins/mocked_tests', 'Some mocked tests failed')
154-
}
155-
sh ''' ./docker/env/hydra.sh clean-aws-mocks '''
156-
}
157-
}
158-
}
159141
stage("integration tests") {
160142
when {
161143
expression {

docker/env/hydra.sh

-22
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ CREATE_RUNNER_INSTANCE=""
2121
RUNNER_IP_FILE="${SCT_DIR}/sct_runner_ip"
2222
RUNNER_IP=""
2323
RUNNER_CMD=""
24-
AWS_MOCK=""
2524

2625
HYDRA_DRY_RUN=""
2726
HYDRA_HELP=""
@@ -55,10 +54,6 @@ while [[ $# -gt 0 ]]; do
5554
RUNNER_IP="$2"
5655
shift 2
5756
;;
58-
--aws-mock)
59-
AWS_MOCK="1"
60-
shift
61-
;;
6257
--dry-run-hydra)
6358
HYDRA_DRY_RUN="1"
6459
shift
@@ -371,23 +366,6 @@ fi
371366

372367
PREPARE_CMD="test"
373368

374-
if [[ -n "${AWS_MOCK}" ]]; then
375-
if [[ -z "${HYDRA_DRY_RUN}" ]]; then
376-
AWS_MOCK_IP=$(${RUNNER_CMD} cat aws_mock_ip)
377-
MOCKED_HOSTS=$(${RUNNER_CMD} openssl s_client -connect "${AWS_MOCK_IP}:443" </dev/null 2>/dev/null \
378-
| openssl x509 -noout -text \
379-
| grep -Po '(?<=DNS:)[^,]+')
380-
else
381-
AWS_MOCK_IP=127.0.0.1
382-
MOCKED_HOSTS="aws-mock.itself scylla-qa-keystore.s3.amazonaws.com ec2.eu-west-2.amazonaws.com"
383-
fi
384-
for host in ${MOCKED_HOSTS}; do
385-
echo "Mock requests to ${host} using ${AWS_MOCK_IP}"
386-
DOCKER_ADD_HOST_ARGS+=(--add-host "${host}:${AWS_MOCK_IP}")
387-
done
388-
PREPARE_CMD+="; curl -sSk https://aws-mock.itself/install-ca.sh | bash"
389-
fi
390-
391369
COMMAND=${HYDRA_COMMAND[0]}
392370

393371
if [[ "$COMMAND" == *'bash'* ]] || [[ "$COMMAND" == *'python'* ]]; then

functional_tests/mocked/__init__.py

-12
This file was deleted.

functional_tests/mocked/conftest.py

-41
This file was deleted.

functional_tests/mocked/test_aws_region.py

-23
This file was deleted.

sct.py

+5-42
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import time
2525
import subprocess
2626
import traceback
27-
import uuid
2827
import pprint
2928
from concurrent.futures import ProcessPoolExecutor
3029
from pathlib import Path
@@ -109,7 +108,7 @@
109108
from sdcm.send_email import get_running_instances_for_email_report, read_email_data_from_file, build_reporter, \
110109
send_perf_email
111110
from sdcm.parallel_timeline_report.generate_pt_report import ParallelTimelinesReportGenerator
112-
from sdcm.utils.aws_utils import AwsArchType, is_using_aws_mock
111+
from sdcm.utils.aws_utils import AwsArchType
113112
from sdcm.utils.aws_okta import try_auth_with_okta
114113
from sdcm.utils.gce_utils import SUPPORTED_PROJECTS, gce_public_addresses
115114
from sdcm.utils.context_managers import environment
@@ -119,7 +118,6 @@
119118
import sdcm.provision.azure.utils as azure_utils
120119
from utils.build_system.create_test_release_jobs import JenkinsPipelines # pylint: disable=no-name-in-module,import-error
121120
from utils.get_supported_scylla_base_versions import UpgradeBaseVersion # pylint: disable=no-name-in-module,import-error
122-
from utils.mocks.aws_mock import AwsMock # pylint: disable=no-name-in-module,import-error
123121

124122

125123
SUPPORTED_CLOUDS = ("aws", "gce", "azure",)
@@ -196,11 +194,10 @@ def cli():
196194
disable_loggers_during_startup()
197195
try_auth_with_okta()
198196

199-
if not is_using_aws_mock():
200-
key_store = KeyStore()
201-
# TODO: still leaving old keys, until we'll rebuild runner images - and reconfigure jenkins
202-
key_store.sync(keys=['scylla-qa-ec2', 'scylla-test', 'scylla_test_id_ed25519'],
203-
local_path=Path('~/.ssh/').expanduser(), permissions=0o0600)
197+
key_store = KeyStore()
198+
# TODO: still leaving old keys, until we'll rebuild runner images - and reconfigure jenkins
199+
key_store.sync(keys=['scylla-qa-ec2', 'scylla-test', 'scylla_test_id_ed25519'],
200+
local_path=Path('~/.ssh/').expanduser(), permissions=0o0600)
204201

205202
docker_hub_login(remoter=LOCALRUNNER)
206203

@@ -1643,40 +1640,6 @@ def clean_runner_instances(runner_ip, test_status, backend, dry_run, force):
16431640
test_runner_ip=runner_ip, test_status=test_status, backend=backend, dry_run=dry_run, force=force)
16441641

16451642

1646-
@cli.command("run-aws-mock", help="Start AWS Mock server Docker container")
1647-
@click.option(
1648-
"-r", "--mock-region",
1649-
required=True,
1650-
multiple=True,
1651-
type=CloudRegion(cloud_provider="aws"),
1652-
help="Mock this AWS region",
1653-
)
1654-
@click.option("-f", "--force", is_flag=True, default=False, help="don't check aws_mock_ip")
1655-
@click.option("-t", "--test-id", required=False, help="SCT Test ID")
1656-
def run_aws_mock(mock_region: list[str], force: bool = False, test_id: str | None = None) -> None:
1657-
add_file_logger()
1658-
if test_id is None:
1659-
test_id = str(uuid.uuid4())
1660-
aws_mock_ip = AwsMock(test_id=test_id, regions=mock_region).run(force=force)
1661-
LOGGER.info("New mock for %r AWS regions started and listen on %s:443 (TestId=%s)",
1662-
mock_region, aws_mock_ip, test_id)
1663-
1664-
1665-
@cli.command("clean-aws-mocks", help="Clean running AWS mock Docker containers")
1666-
@click.option("-t", "--test-id", required=False, help="Clean AWS Mock container for test id")
1667-
@click.option(
1668-
"-a", "--all", "all_mocks",
1669-
is_flag=True,
1670-
default=False,
1671-
help="Clean all AWS Mock containers running on this host",
1672-
)
1673-
@click.option('--verbose', is_flag=True, default=False, help="if enable, will log progress")
1674-
@click.option("--dry-run", is_flag=True, default=False, help="dry run")
1675-
def clean_aws_mocks(test_id: str | None, all_mocks: bool, verbose: bool, dry_run: bool) -> None:
1676-
add_file_logger()
1677-
AwsMock.clean(test_id=test_id, all_mocks=all_mocks, verbose=verbose, dry_run=dry_run)
1678-
1679-
16801643
@cli.command("generate-pt-report", help="Generate parallel timelines representation for the SCT test events")
16811644
@click.option("-t", "--test-id", envvar='SCT_TEST_ID', help="Test ID to search in sct-results")
16821645
@click.option("-d", "--logdir", envvar='HOME', type=click.Path(exists=True),

utils/mocks/__init__.py

Whitespace-only changes.

utils/mocks/aws_mock.py

-127
This file was deleted.

0 commit comments

Comments
 (0)