Files
seaweedfs/test/s3/tagging
Chris Lu 2e9b944e5c test(s3): aim collection force-delete at the master the suite actually runs (#10404)
The copying and tagging tests force-drop each bucket's collection at the
master so volume slots are freed deterministically between tests. But the
copy-tests CI job runs its master on 9336 and the tagging Makefile on 9338,
while the tests default to 9333 — the cleanup dialed a dead port and quietly
no-oped. Each test bucket then grows 7 volumes against -volume.max=100, and
whenever async deletion lagged the data node ran out of slots and PutObject
500ed with "No writable volumes and no free volumes left".

Set MASTER_ENDPOINT where the master port is non-default: the copy-tests
workflow step, and the copying/tagging Makefiles (derived from MASTER_PORT).
2026-07-22 21:37:59 -07:00
..
2025-12-01 15:21:30 -08:00

S3 Object Tagging Tests

This directory contains tests for S3 object tagging functionality.

Issue Reference

These tests were created to verify the fix for GitHub Issue #7589: S3 object Tags query comes back empty

Problem Description

When uploading an object with tags using the X-Amz-Tagging header, the tags were not being stored. When querying the object tagging with GetObjectTagging, the response was empty.

This was a regression between SeaweedFS 4.00 and 4.01.

Root Cause

The putToFiler function in s3api_object_handlers_put.go was not parsing the X-Amz-Tagging header and storing the tags in the entry's Extended metadata. The code was only copying user metadata (headers starting with X-Amz-Meta-) but not object tags.

Fix

Added tag parsing logic to putToFiler that:

  1. Reads the X-Amz-Tagging header
  2. Parses it using url.ParseQuery() for proper URL decoding
  3. Stores each tag with the prefix X-Amz-Tagging- in the entry's Extended metadata

Running Tests

# Run all tagging tests
cd test/s3/tagging
make test

# Run specific test
make test-upload

# Or using go test directly
go test -v ./...

Test Cases

  1. TestObjectTaggingOnUpload - Basic test for tags sent during object upload
  2. TestObjectTaggingOnUploadWithSpecialCharacters - Tests URL-encoded tag values
  3. TestObjectTaggingOnUploadWithEmptyValue - Tests tags with empty values
  4. TestPutObjectTaggingAPI - Tests the PutObjectTagging API separately
  5. TestDeleteObjectTagging - Tests tag deletion
  6. TestTagsNotPreservedAfterObjectOverwrite - Verifies AWS S3 behavior on overwrite
  7. TestMaximumNumberOfTags - Tests storing the maximum 10 tags
  8. TestTagCountHeader - Tests the x-amz-tagging-count header in HeadObject