aaron-y-chen opened a new pull request, #77748:
URL: https://github.com/apache/airflow/pull/77748

   `example_azure_blob_to_s3` names its S3 bucket 
`{env_id}-azure_blob-to-s3-bucket`. S3 general purpose bucket names may contain 
only lowercase letters, numbers, dots and hyphens ([General purpose bucket 
naming 
rules](https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html)),
 so `create_s3_bucket` fails with `InvalidBucketName` and the test never 
reaches the transfer.
   
   The Azure container name `{env_id}-azure_blob-to-s3-container` has the same 
problem: container names may contain only lowercase letters, numbers and 
hyphens ([Naming and referencing containers, blobs, and 
metadata](https://learn.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#container-names)).
 The S3 error hides it today, but it would fail as soon as the bucket is 
created.
   
   This PR changes `azure_blob` to `azure-blob` in both names. The S3 key gets 
the same change so the three names stay consistent; underscores are valid in 
object keys.
   
   ## Testing
   
   I ran the system test locally against two AWS emulators:
   
   - [AWS Emulator](https://github.com/aws/aws-emulator) 1.0.611.
   - LocalStack 4.7, through the existing `--integration localstack`:
   
     ```bash
     breeze shell --backend sqlite --python 3.12 --integration localstack 
--skip-environment-initialization \
       -c "export AWS_ENDPOINT_URL=http://localstack:4566 
AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test \
             AWS_DEFAULT_REGION=us-east-1 AWS_CONFIG_FILE=/dev/null 
AWS_EC2_METADATA_DISABLED=true; \
           pytest --system 
providers/amazon/tests/system/amazon/aws/example_azure_blob_to_s3.py"
     ```
   
   Both emulators gave the same results:
   
   | Task | Before | After |
   | --- | --- | --- |
   | `create_s3_bucket` | Fails: `InvalidBucketName` | Succeeds |
   | `azure_blob_to_s3` | Skipped (upstream failed) | Fails: no Azure 
credentials in the local environment (expected) |
   | `delete_s3_bucket` | Nothing to delete | Deletes the bucket |
   
   I also checked both container names against Azurite. The old name is 
rejected with `400 InvalidResourceName`, and the new name is accepted.
   
   The example does not create its Azure container or blob, so on its own the 
test still needs existing Azure resources and a `wasb_default` connection. With 
the container and a blob pre-created in Azurite, the whole test passes against 
LocalStack and Azurite: the blob is copied to S3, then the object and bucket 
are deleted. I have not run it against real AWS or Azure.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] Fix invalid resource nam... aaron-y-chen (via GitHub) via commits

Reply via email to