Skip to content

Update purge suffix so that resources are preserved for at least as long as the configured timeout.#2265

Merged
nfx merged 8 commits intomainfrom
fix-purge-suffix
Jul 30, 2024
Merged

Update purge suffix so that resources are preserved for at least as long as the configured timeout.#2265
nfx merged 8 commits intomainfrom
fix-purge-suffix

Conversation

@asnare
Copy link
Copy Markdown
Contributor

@asnare asnare commented Jul 29, 2024

Changes

This PR updates the purge suffix used by integration tests so that resources are marked for preservation at least as long as the configured timeout. The situation is that:

  • Many resources can be marked with a tag (or a special suffix in the name) to ensure they are preserved until a specific time.
  • The timestamp refers to a UTC-based hour, such as: 2024072915. This means that resources can be deleted at any moment after 3 p.m. (UTC).
  • Prior to this change, resources created as late as 2:44:59 p.m. would be tagged for deletion with 2024072915 meaning deletion as of 3 p.m. This is 0:15 later instead of the intended 1:15.

The default timeout for tests was 1:15 in an attempt to deal with resources being deleted when the test started near the hour boundary. This PR also updates the default timeout to 1:00 because the extra 0:15 isn't needed to ensure this.

asnare added 3 commits July 29, 2024 17:42
…g as the requested timeout.

Prior to these changes the effective timeout could be as short as 0:15min instead of the intended 1:15.
@asnare asnare added bug/test-infra issues related to testing infrastructure internal this pull request won't appear in release notes labels Jul 29, 2024
@asnare asnare self-assigned this Jul 29, 2024
@asnare asnare requested review from a team and FastLee July 29, 2024 16:00
@asnare asnare changed the title Update purge suffix so that resources are preserved for _at least_ as long as the configured timeout. Update purge suffix so that resources are preserved for at least as long as the configured timeout. Jul 29, 2024
@asnare asnare marked this pull request as draft July 29, 2024 16:02
@asnare asnare marked this pull request as ready for review July 29, 2024 16:09
from databricks.labs.ucx.installer.logs import PartialLogRecord, parse_logs
from databricks.labs.ucx.installer.mixins import InstallationMixin

from ..mixins.fixtures import get_test_purge_time
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this includes pytest into the runtime path of UCX installation, which is going to break customers. copy the code. otherwise adjust the new_installation fixture, which is a more proper way of doing this.

@asnare asnare temporarily deployed to account-admin July 30, 2024 09:15 — with GitHub Actions Inactive
@asnare asnare requested review from JCZuurmond and nfx July 30, 2024 09:16
@github-actions
Copy link
Copy Markdown

✅ 24/24 passed, 1 flaky, 49m31s total

Flaky tests:

  • 🤪 test_compare_remote_local_install_versions (3m18.288s)

Running from acceptance #4950

Copy link
Copy Markdown
Contributor

@JCZuurmond JCZuurmond left a comment

Choose a reason for hiding this comment

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

LGTM

now = datetime.now(timezone.utc)
purge_deadline = now + timeout
# Round UP to the next hour boundary: that is when resources will be deleted.
purge_hour = purge_deadline + (datetime.min.replace(tzinfo=timezone.utc) - purge_deadline) % timedelta(hours=1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I find the following logic complicated to round up to an hour: (datetime.min.replace(tzinfo=timezone.utc) - purge_deadline) % timedelta(hours=1)

Copy link
Copy Markdown
Collaborator

@nfx nfx left a comment

Choose a reason for hiding this comment

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

this is still a hack but okay

@nfx nfx merged commit 815c7e8 into main Jul 30, 2024
@nfx nfx deleted the fix-purge-suffix branch July 30, 2024 13:15
nfx pushed a commit that referenced this pull request Jul 31, 2024
## Changes

This PR fixes some tests that check the value of `RemoveAfter` tags:
they check how far into the future the tag-value is, and this can now be
up to 2 hours due to rounding upwards introduced in #2265.

### Linked issues

@ericvergnaud observed some failing acceptance tests on #2330, which
this will fix.

Resolves #2287.
Resolves #2288.
Resolves #2289.
Resolves #2290.

### Tests

- updated integration tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug/test-infra issues related to testing infrastructure internal this pull request won't appear in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants