Skip to content

Commit 0b13419

Browse files
committed
fixed tests
1 parent bf77b83 commit 0b13419

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Before testing, ensure you have all the required packages installed:
161161
::
162162

163163
pip install -r requirements.txt
164+
pip install psycopg2-binary
164165

165166
Once the dependencies are installed, you can run the tests using the provided script:
166167

tests/pystackql_tests.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ def setUpModule():
4141
print("downloading aws provider for tests...")
4242
res = PyStackQLTestsBase.stackql.executeStmt(registry_pull_aws_query)
4343
print(res)
44+
print("downloading awscc provider for tests...")
45+
res = PyStackQLTestsBase.stackql.executeStmt(registry_pull_awscc_query)
46+
print(res)
4447
print("downloading google provider for tests...")
4548
res = PyStackQLTestsBase.stackql.executeStmt(registry_pull_google_query)
4649
print(res)
@@ -201,8 +204,8 @@ def test_12_execute_with_pandas_output(self):
201204
self.assertTrue(is_valid_dataframe, f"Result is not a valid DataFrame: {result}")
202205
# Check datatypes of the columns
203206
expected_dtypes = {
204-
'instance_state': 'object', # This should be 'object' for older Pandas versions
205-
'num_instances': 'int64'
207+
'year': 'int64',
208+
'num_buckets': 'int64'
206209
}
207210
for col, expected_dtype in expected_dtypes.items():
208211
actual_dtype = result[col].dtype
@@ -280,8 +283,8 @@ def test_22_execute_server_mode_pandas_output(self):
280283
self.assertTrue(is_valid_dataframe, f"Result is not a valid DataFrame: {result}")
281284
# Check datatypes of the columns
282285
expected_dtypes = {
283-
'instance_state': 'object', # This should be 'object' for older Pandas versions
284-
'num_instances': 'int64'
286+
'year': 'int64',
287+
'num_buckets': 'int64'
285288
}
286289
for col, expected_dtype in expected_dtypes.items():
287290
actual_dtype = result[col].dtype

tests/test_params.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get_custom_download_dir(platform_name):
2727

2828
registry_pull_google_query = "REGISTRY PULL google"
2929
registry_pull_aws_query = "REGISTRY PULL aws"
30+
registry_pull_awscc_query = "REGISTRY PULL awscc"
3031
registry_pull_okta_query = "REGISTRY PULL okta"
3132
registry_pull_github_query = "REGISTRY PULL github"
3233

@@ -43,21 +44,18 @@ def registry_pull_resp_pattern(provider):
4344

4445
aws_query = f"""
4546
SELECT
46-
split_part(instanceState, '\n', 3) as instance_state,
47-
count(*) as num_instances
48-
FROM aws.ec2.instances
49-
WHERE region = '{os.environ['AWS_REGION']}'
50-
GROUP BY instance_state
47+
SPLIT_PART(CreationDate, '-', 1) as year, count(*) as num_buckets FROM aws.s3.buckets
48+
WHERE region = 'us-east-1'
49+
GROUP BY year
5150
"""
5251

5352
regions = os.environ.get('AWS_REGIONS').split(',')
5453

5554
async_queries = [
5655
f"""
57-
SELECT '{region}' as region, instanceType, COUNT(*) as num_instances
58-
FROM aws.ec2.instances
56+
SELECT region, COUNT(*) as num_functions
57+
FROM awscc.lambda.functions
5958
WHERE region = '{region}'
60-
GROUP BY instanceType
6159
"""
6260
for region in regions
6361
]

0 commit comments

Comments
 (0)