Skip to content

fix double filename calls while put'ing#26

Draft
petermueller wants to merge 8 commits into
v0.2.xfrom
pkm/fix-double-filename
Draft

fix double filename calls while put'ing#26
petermueller wants to merge 8 commits into
v0.2.xfrom
pkm/fix-double-filename

Conversation

@petermueller

Copy link
Copy Markdown
Collaborator

DO NOT MERGE TO main

Due to scope of change (and based on prior discussion) we may prefer to just roll this into a 0.3 version release.

TODO

  • update test setup for failing tests
  • clean up organization of tests
  • extend usage of unique_basename / tmp_dir tag to the rest of the CloudStorage tests

WIP - adding more robusts integration tests
@petermueller petermueller mentioned this pull request Feb 3, 2025
@petermueller

petermueller commented Jun 2, 2025

Copy link
Copy Markdown
Collaborator Author

@achempion
Since a lot of these tests are modifications/tweaks of the S3 tests, I'm thinking it makes sense to have this be part of a first pass at pulling GCP into the upstream.

My only concern is that the dependencies of gcp go back to Google 's maintained library that is half abandoned and still using a very outdated version of Poison and some other libraries.

When we pull it in I think it may be beneficial to have waffle be a monorepo for the ease of testing all the adapters but still separate mix files until we can move away from that library or figure something else out

What are your thoughts?

@achempion

Copy link
Copy Markdown
Member

My only concern is that the dependencies of gcp go back to Google 's maintained library that is half abandoned and still using a very outdated version of Poison and some other libraries.

It shouldn't be an issue with monorepo, as including them will be a part of adapter specific documentation similar to how it works in Swoosh

Since a lot of these tests are modifications/tweaks of the S3 tests, I'm thinking it makes sense to have this be part of a first pass at pulling GCP into the upstream.

agree 👍

Introduce Waffle.GCSCase, an ExUnit.CaseTemplate that centralizes the
integration-test setup, helpers (env_bucket/bucket_url/with_env), and
assertion macros (assert_public/assert_private/assert_header/
assert_public_with_extension/assert_acls_public_reader/
delete_and_assert_gone) that were previously copy-pasted across test files.
It also applies the :integration and :tmp_dir moduletags.

Add feature_definitions.ex: focused, single-purpose Waffle definitions
(GCSTest.*), each exercising exactly one feature, plus GCSTest.FilenameProbe
(@async false + a send/self probe) used by the double-filename regression
test.
gcs_features_test.exs is the canonical public-API integration suite: each
test drives one Waffle feature through definition.store/url/delete against
real GCS, using the single-purpose GCSTest.* definitions and the shared
Waffle.GCSCase. It folds back the coverage the earlier ad-hoc suites had
dropped: object ACL assertions, stored-name equality checks, the pre-store
URL assertion for a definition-level bucket, and per-version extension
assertions.

double_filename_regression_test.exs is an explicit guard for issue #25:
GCSTest.FilenameProbe announces every filename/2 invocation, so the test
asserts (assert_received/refute_received) that the name is resolved exactly
once per version during store and that the stored object name is not
double-prefixed.
cloud_storage_test.exs now covers only the CloudStorage module boundary:
pure-unit path/name construction (storage_dir/3, path_for/3, bucket/1 with a
literal) that needs no network, plus the put/delete/url round-trips tagged
:integration. The duplicated 'from upstream storage tests' block, the
copy-pasted assertion macros, and the leftover IO.inspect calls are gone
(macros now live only in Waffle.GCSCase).

Delete test/support/definitions.ex: the old multi-purpose fixtures were only
used by the now-removed redundant suites. Repoint cleanup.ex's after_suite
teardown at GCSTest.PublicUpload.
Add a tag-taxonomy comment block to test_helper.exs explaining :integration,
:tmp_dir, :bucket_with_file_and_scope, double_filename_regression, skip, and
upstream_mismatch, including how each is toggled with --include/--exclude and
a note that future-behavior skips should become exclude tags for 0.3.

Add a 'mix test.unit' alias (test --exclude integration) with a preferred_env
so the fast, offline unit tests run without GCS credentials, and document the
env vars and example invocations in the README.
Document how to bring the double-filename fix and the test overhaul forward
into main (0.3): the precise put/3 + path_for/3 + fullname/3 lib delta and why
it differs from PR #1, the orthogonal token-fetcher divergence to avoid
dragging along, the cherry-pick order for the four test commits with their
conflict points, and the version-gating flip that makes the
:bucket_with_file_and_scope test run (and fail) once main hits 0.3.

Lives under plans/, which is outside the mix.exs files: whitelist and so is
excluded from the published hex package.
…tooling

Distilled from a full review of the lib and test suite. Index in
plans/README.md; work items tracked on GitHub as milestone v0.3
(issues #27-#37) plus #38 (offline suite), #39 (client rewrite),
and #40 (migration/repair tooling).

forward-port-to-main.md updated in place: the section 4 version-gating
question is decided as option (a) (bucket-from-scope, #33), and
WAFFLE_BUCKET2 is now available as a GHA repository secret.
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