Skip to content

Commit f374f28

Browse files
aws-v2-divas
Summary: - Accomodate problematic `aws` interfaces. - `SELECT` from `aws.s3.buckets` working in real life. - `SELECT` on `aws.s3.objects` working. - Bucket locations working for real. - Added robot integration test `AWS S3 Buckets Location Constraint`. - Added robot integration test `AWS S3 Buckets List`. - Added robot integration test `AWS S3 Bucket Objects List`.
1 parent 8e69e58 commit f374f28

File tree

12 files changed

+21857
-15551
lines changed

12 files changed

+21857
-15551
lines changed

.github/workflows/build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,26 @@ jobs:
742742
echo "## End ##"
743743
python cicd/python/build.py --robot-test-integration
744744
745+
- name: Run traffic light robot integration tests
746+
if: (startsWith(env.STATE_SOURCE_TAG, 'build-traffic-lights') || (github.repository == 'stackql/stackql' && github.event_name == 'push' && github.ref == 'refs/heads/main')) && matrix.registry == 'test/registry'
747+
env:
748+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
749+
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
750+
AZURE_INTEGRATION_TESTING_SUB_ID: ${{ secrets.AZURE_INTEGRATION_TESTING_SUB_ID }}
751+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
752+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
753+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
754+
run: |
755+
echo "## Stray flask apps to be killed before robot tests ##"
756+
pgrep -f flask | xargs kill -9 || true
757+
echo "## End ##"
758+
if "$(python cicd/python/build.py --robot-test-traffic-lights-integration)"; then
759+
echo "Traffic light robot integration tests **all** passed"
760+
else
761+
rv="$?"
762+
echo "**some** traffic light robot integration tests failed code = $rv"
763+
fi
764+
745765
- name: Prepare Test DB
746766
if: success() && matrix.registry != 'test/registry'
747767
run: cp test/db/db.sqlite test/db/tmp/python-tests-tmp-db.sqlite

cicd/python/build.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,20 @@ def run_robot_integration_tests_stackql(*args, **kwargs) -> int:
6767
return subprocess.call(
6868
'robot '
6969
f'{variables} '
70-
'-d test/robot/integration '
70+
'-d test/robot/reports-integration '
7171
'test/robot/integration',
7272
shell=True
7373
)
7474

75+
def run_robot_integration_traffic_lights_tests_stackql(*args, **kwargs) -> int:
76+
variables = ' '.join([f'--variable {key}:{sanitise_val(value)} ' for key, value in kwargs.get("variables", {}).items()])
77+
return subprocess.call(
78+
'robot '
79+
f'{variables} '
80+
'-d test/robot/reports-integration-traffic-lights '
81+
'test/robot/integration-traffic-lights',
82+
shell=True
83+
)
7584

7685
def main():
7786
parser = argparse.ArgumentParser()
@@ -81,6 +90,7 @@ def main():
8190
parser.add_argument('--test', action='store_true')
8291
parser.add_argument('--robot-test', action='store_true')
8392
parser.add_argument('--robot-test-integration', action='store_true')
93+
parser.add_argument('--robot-test-traffic-lights-integration', action='store_true')
8494
parser.add_argument('--config', type=json.loads, default={})
8595
args = parser.parse_args()
8696
ret_code = 0
@@ -104,6 +114,10 @@ def main():
104114
ret_code = run_robot_integration_tests_stackql(**args.config)
105115
if ret_code != 0:
106116
exit(ret_code)
117+
if args.robot_test_traffic_lights_integration:
118+
ret_code = run_robot_integration_traffic_lights_tests_stackql(**args.config)
119+
if ret_code != 0:
120+
exit(ret_code)
107121
exit(ret_code)
108122

109123

test/python/stackql_test_tooling/flask/aws/app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,14 @@ def _extract_request_region(request: Request) -> str:
216216
def handle_root_requests():
217217
return generic_handler(request)
218218

219+
@app.route('/stackql-trial-bucket-01', methods=["GET"])
220+
def handle_object_list_requests():
221+
return generic_handler(request)
222+
223+
@app.route('/stackql-trial-bucket-02', methods=["GET"])
224+
def handle_object_list2_requests():
225+
return generic_handler(request)
226+
219227
@app.route('/2013-04-01/hostedzone/<rrset_id>/rrset/', methods=['POST', 'GET'])
220228
def handle_rrset_requests(rrset_id: str):
221229
return generic_handler(request)

test/python/stackql_test_tooling/flask/aws/root_path_cfg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
},
251251
"GET:/:10": {
252252
"method": "GET",
253-
"path": "/",
253+
"path": "/stackql-trial-bucket-01",
254254
"queryStringParameters": {
255255
"max-keys": [ "1000" ]
256256
},
@@ -286,7 +286,7 @@
286286
},
287287
"GET:/:12": {
288288
"method": "GET",
289-
"path": "/",
289+
"path": "/stackql-trial-bucket-01",
290290
"queryStringParameters": {
291291
"location": [ "" ]
292292
},

test/python/stackql_test_tooling/stackql_context.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,10 +678,10 @@ def generate_password() -> str:
678678
SELECT_AZURE_COMPUTE_VIRTUAL_MACHINES_JSON_EXPECTED = get_json_from_local_file(os.path.join('test', 'assets', 'expected', 'azure', 'compute', 'vm-list.json'))
679679
SELECT_AZURE_COMPUTE_BILLING_ACCOUNTS_JSON_EXPECTED = get_json_from_local_file(os.path.join('test', 'assets', 'expected', 'azure', 'billing', 'billing-account-list.json'))
680680

681-
SELECT_AWS_S3_BUCKET_LOCATIONS = "select LocationConstraint from aws.s3.bucket_locations where region = 'ap-southeast-1' and bucket = 'stackql-trial-bucket-01';"
681+
SELECT_AWS_S3_BUCKET_LOCATIONS = "select LocationConstraint from aws.s3.bucket_locations where region = 'ap-southeast-1' and Bucket = 'stackql-trial-bucket-01';"
682682
SELECT_AWS_S3_BUCKETS = "select Name, CreationDate from aws.s3.buckets where region = 'ap-southeast-1' order by Name ASC;"
683-
SELECT_AWS_S3_OBJECTS = "select \"Key\", Size, StorageClass from aws.s3.objects where region = 'ap-southeast-1' and bucket = 'stackql-trial-bucket-01' order by \"Key\" ASC;"
684-
SELECT_AWS_S3_OBJECTS_NULL = "select \"Key\", Size, StorageClass from aws.s3.objects where region = 'ap-southeast-2' and bucket = 'stackql-trial-bucket-02' order by \"Key\" ASC;"
683+
SELECT_AWS_S3_OBJECTS = "select \"Key\", Size, StorageClass from aws.s3.objects where region = 'ap-southeast-1' and Bucket = 'stackql-trial-bucket-01' order by \"Key\" ASC;"
684+
SELECT_AWS_S3_OBJECTS_NULL = "select \"Key\", Size, StorageClass from aws.s3.objects where region = 'ap-southeast-2' and Bucket = 'stackql-trial-bucket-02' order by \"Key\" ASC;"
685685
SELECT_AWS_EC2_VPN_GATEWAYS_NULL = "select vpnGatewayId, amazonSideAsn from aws.ec2.vpn_gateways where region = 'ap-southeast-1' order by vpnGatewayId ASC;"
686686
SELECT_AWS_VOLUMES = "select volumeId, encrypted, size from aws.ec2.volumes where region = 'ap-southeast-1' order by volumeId asc;"
687687
SELECT_AWS_IAM_USERS_ASC = "select UserName, Arn from aws.iam.users WHERE region = 'us-east-1' order by UserName ASC;"

0 commit comments

Comments
 (0)