Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcase to test the api quota limit #165

Merged
merged 15 commits into from
Sep 8, 2023
Merged

Testcase to test the api quota limit #165

merged 15 commits into from
Sep 8, 2023

Conversation

bhuvana-talend
Copy link
Contributor

Description of change

https://jira.talendforge.org/browse/TDL-23431
Run the sync job and make sure the per-run-limit is applied.
Split from feature https://jira.talendforge.org/browse/TDL-23349

QA steps

  • automated tests passing
  • manual qa steps passing (list below)

Risks

Rollback steps

  • revert this branch

tests/sfbase.py Outdated Show resolved Hide resolved
tests/sfbase.py Outdated Show resolved Hide resolved
tests/sfbase.py Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
@bhtowles
Copy link
Contributor

Also the table reset test is missing a manipulate state method. Is this in another PR somewhere? I thought I remembered someone talking about building that out.

tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_total_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_total_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_total_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved

# run check mode
# Run a check job using orchestrator (discovery)
with self.assertRaises(Exception) as ex:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per run did not raise exception on last commit. could the check job use less than 1 percent quota?

FAIL: test_api_per_run_quota (test_salesforce_api_per_run_quota.SFAPIQuota)
Run the tap in check mode and verify it returns the error for quota limit reached. If not, proceed to sync mode.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/project/tests/test_salesforce_api_per_run_quota.py", line 60, in test_api_per_run_quota
    found_catalogs = self.run_and_verify_check_mode( conn_id)
AssertionError: Exception not raised

2023-08-30 14:32:00,401 TapTester - INFO     ***** Test Results *****
----------------------------------------------------------------------
Ran 1 tests in 107s

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't have less than 1%, couldn't send fraction amount. This is very tricky, let's discuss.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not guaranteed to hit the per run quota in check mode can we do a "try / catch" for check mode and then use the normal "assertRaises" for sync mode? That way if the quota is hit during check mode we can catch the error and verify it and if it is not hit until sync mode we can also catch it there. If that works I'd use the same pattern for both tests.

@bhuvana-talend
Copy link
Contributor Author

Also the table reset test is missing a manipulate state method. Is this in another PR somewhere? I thought I remembered someone talking about building that out.

https://jira.talendforge.org/browse/TDL-23972 - I also remember a conversation regarding this, created this card

tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_per_run_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_total_quota.py Outdated Show resolved Hide resolved
tests/test_salesforce_api_total_quota.py Outdated Show resolved Hide resolved

conn_id = connections.ensure_connection(self)

# run check mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# run check mode

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you in favor of keeping this line?


# run check mode
# Run a check job using orchestrator (discovery)
with self.assertRaises(Exception) as ex:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not guaranteed to hit the per run quota in check mode can we do a "try / catch" for check mode and then use the normal "assertRaises" for sync mode? That way if the quota is hit during check mode we can catch the error and verify it and if it is not hit until sync mode we can also catch it there. If that works I'd use the same pattern for both tests.

# Run a check job using orchestrator (discovery)
try:
found_catalogs = self.run_and_verify_check_mode(conn_id)
except Exception as ex:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
except Exception as ex:
except Exception as ex:
self.assertIn(expected_per_run_error, str(ex.exception))
raise ex

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the try catch raises the exception we can still do the assertion on the exception I think.


conn_id = connections.ensure_connection(self)

# run check mode
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you in favor of keeping this line?

@bhuvana-talend bhuvana-talend merged commit 4c92b4d into master Sep 8, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants