#113 Added implementation for the SaaS Bucket.#116
Conversation
| typeguard = "4.0.0" | ||
| saas-api=">=0.2.0" | ||
| # Temp.fix | ||
| httpx=">=0.27.0" |
There was a problem hiding this comment.
Could the saas api also use requests?
Do we need async support? (If so we may also should migrate bucketfs to httpx at some point)
There was a problem hiding this comment.
I don't think we need the async support, based on the current definition of the BucketLike. May do in the future, but this is outside the scope of this ticket.
| def saas_test_database_id(saas_test_service_url, saas_test_token, saas_test_account_id) -> str: | ||
|
|
||
| with create_saas_test_client( | ||
| url=saas_test_service_url, | ||
| token=saas_test_token | ||
| ) as client: | ||
| db: Optional[openapi.models.database.Database] = None | ||
| try: | ||
| db = create_saas_test_database( | ||
| account_id=saas_test_account_id, | ||
| client=client | ||
| ) | ||
| # Wait till the database gets to the running state. | ||
| sleep_time = 600 | ||
| small_interval = 20 | ||
| max_wait_time = 2400 | ||
| max_cycles = 1 + (max_wait_time - sleep_time) // small_interval | ||
| for _ in range(max_cycles): | ||
| time.sleep(sleep_time) | ||
| db = get_saas_database( | ||
| account_id=saas_test_account_id, | ||
| database_id=db.id, | ||
| client=client | ||
| ) | ||
| if db.status == SaasStatus.RUNNING: | ||
| break | ||
| sleep_time = 30 | ||
| else: | ||
| raise RuntimeError(f'Test SaaS database status is {db.status} ' | ||
| f'after {max_wait_time} seconds.') | ||
| yield db.id | ||
| finally: | ||
| if db is not None: | ||
| delete_saas_database( | ||
| account_id=saas_test_account_id, | ||
| database_id=db.id, |
There was a problem hiding this comment.
doesn't the saas api provide such a fixture?
There was a problem hiding this comment.
Not yet. It will soon. At which point we may want to update this repo. However, there is a bigger problem that we may need to address - the testing of the SaaS bucket can't be done in the normal check workflow of the Python Toolbox.
Nicoretti
left a comment
There was a problem hiding this comment.
As discussed, based the outcome of your logger.debug("%s", "value") vs logger.debug("{}", "value") investigation, either update or merge.
closes #113
Submission Checklist