canonical / postgresql-k8s-operator

A Charmed Operator for running PostgreSQL on Kubernetes
https://charmhub.io/postgresql-k8s
Apache License 2.0
10 stars 19 forks source link

botocore.exceptions.ClientError when trying to run integration tests #718

Open Zvirovyi opened 1 week ago

Zvirovyi commented 1 week ago

Steps to reproduce

  1. Clone the project
  2. Run the backups integration test: tox -e integration -- tests/integration/test_backups.py::test_backup_aws --keep-models
  3. Encounter botocore.exceptions.ClientError error

Expected behavior

Test to successfully complete.

Actual behavior

Test fails with ERROR tests/integration/test_backups.py::test_backup_aws - botocore.exceptions.ClientError: An error occurred (SignatureDoesNotMatch) when calling the ListObjects operation: Access denied.

Versions

Operating system: Ubuntu 24.04.1 LTS

Juju CLI: 3.5.3-genericlinux-amd64 (also tried 3.4.x, but same result)

Juju agent: 3.5.3 (also tried 3.4.x, but same result)

Charm revision: 5a89a40d3887ae985315910194d155eb18306e4c (latest commit). Also tried rev371 as of 30.08.2024, but same result.

microk8s: MicroK8s v1.31.1 revision 7234 (tried 1.30, 1.29 with the same result)

Log output

Juju debug log: k8s_SignatureDoesNotMatch.log

Additional context

Same issue on the VM: https://github.com/canonical/postgresql-operator/issues/635.

syncronize-issues-to-jira[bot] commented 1 week ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-5593.

This message was autogenerated

marceloneppel commented 6 days ago

Hi, @Zvirovyi! Thanks for the report.

The issue is caused by the GCP credentials not being present in the SECRETS_FROM_GITHUB environment variable; the test teardown code is trying to list objects from GCS (as well as from AWS) at https://github.com/canonical/postgresql-k8s-operator/blob/73cafdade82ee2913b5b61d7dc7280dd3898c167/tests/integration/test_backups_pitr.py#L91, but there are no credentials to access the bucket/path.

One possible solution is to check whether the credentials are available in the test teardown code before trying to list the objects from GCS.