Skip to content

Conversation

@dominikschubert
Copy link
Member

@dominikschubert dominikschubert commented Feb 1, 2024

Motivation

In our ongoing effort to externalize core components of our development framework, the snapshot testing lib is now next on the line.

Changes

  • Extracts the snapshot library into a new repo https://github.com/localstack/localstack-snapshot
  • Adds pinned dependency on new localstack-snapshot lib (naming will probably change later, just a generic name for now)
  • Fixes import paths in tests
  • Usage of is_aws() replaced with is_aws_cloud() from localstack.testing.aws.util

Follow-ups / TODOs

There's still a bit of refactoring left, but the lib can at least now be used without calling AWS like it previously did. It also doesn't add any default transformers on its own, so that's why we need to add them in our conftest ourselves now.

The transformer utility file hasn't been moved since most of the transformers in there don't make sense in a generic context. Will iterate over this at a later point.

@dominikschubert dominikschubert self-assigned this Feb 1, 2024
@github-actions
Copy link

github-actions bot commented Feb 1, 2024

LocalStack Community integration with Pro

    2 files      2 suites   1h 20m 38s ⏱️
2 632 tests 2 382 ✅ 250 💤 0 ❌
2 634 runs  2 382 ✅ 252 💤 0 ❌

Results for commit 2a7be19.

♻️ This comment has been updated with latest results.

@dominikschubert dominikschubert added the semver: patch Non-breaking changes which can be included in patch releases label Feb 1, 2024
@github-actions
Copy link

github-actions bot commented Feb 2, 2024

S3 Image Test Results (AMD64 / ARM64)

  2 files    2 suites   3m 12s ⏱️
386 tests 336 ✅  50 💤 0 ❌
772 runs  672 ✅ 100 💤 0 ❌

Results for commit 2a7be19.

♻️ This comment has been updated with latest results.

Copy link
Member

@steffyP steffyP left a comment

Choose a reason for hiding this comment

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

Nice work 🎉 LGTM!

Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

nice work! can't wait to start using the lib in other projects :-)

@dominikschubert dominikschubert force-pushed the snapshot-lib-extraction branch 3 times, most recently from 9057684 to 1a21b77 Compare February 8, 2024 09:47
@coveralls
Copy link

coveralls commented Feb 8, 2024

Coverage Status

coverage: 83.876% (+0.003%) from 83.873%
when pulling 2a7be19 on snapshot-lib-extraction
into cd3dcd6 on master.

setup.cfg Outdated
pytest-tinybird>=0.2.0
aws-cdk-lib>=2.88.0
websocket-client>=1.7.0
localstack-snapshot~=0.1.0
Copy link
Member

Choose a reason for hiding this comment

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

Chiming in here from the side, after discussing this PR in localstack/localstack-snapshot#2. 😛
And unfortunately, I cannot comment on line 95, which is why I will just add two comments in one here:

  • line # 95: Would be great to change this exact pin to a min version as discussed in remove pin on jsonpath-ng and fix issue localstack-snapshot#2.
  • line # 118: With the new dependency pinning we have a coordinated update mechanism, which automatically tries to update the lock files to the highest possible version. With remove pins in setup.cfg, add .python-version #10195 we removed as many pins as possible to increase the efficiency of the automated updates. I think we should now avoid upper version limits wherever possible. It would be great if we could replace ~ with > in this line.

Copy link
Member Author

Choose a reason for hiding this comment

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

Regarding the second point, I was mostly trying to avoid > due to the lib not strictly following semantic versioning yet. rolo had the same constraint, but since this was removed in the unpinning PR I guess we can remove it here as well.

Comment on lines 190 to 193
jsonpath-ng==1.5.3
# via localstack-core (pyproject.toml)
# via
# localstack-core (pyproject.toml)
# localstack-snapshot
Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting observation here. The pin stays the same because of the transitive dependency/constraint from localstack-snapshot 0.1.0, but for non-test targets the dependency is actually updated.

In our current test setup this will mean the localstack we're running our tests against will have a different version of jsonpath-ng than the one that we ship 🤔

I'm not sure this is a situation we want. This would be resolved by testing against the actual built container without mounting/installing any test dependencies in there, but for now it might lead to some fairly confusing situations.

This also prompts the question if we should maybe add a way to highlight/restrict these conflicting cases somewhere (e.g. in the periodic dependency updates), since this can continue occurring for other dependencies as well. cc @alexrashed @silv-io

Copy link
Member

Choose a reason for hiding this comment

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

Wow, great catch! That is a very good point, and great input for an upcoming iteration on the dependency pinning automation (and maybe the pre-commit hook)!
For this particular case, we should then move forward, merge the upgrade in localstack-snapshot, create a release, and fix the issue hat hand (different versions for testing and publishing).

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

Labels

semver: patch Non-breaking changes which can be included in patch releases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants