|
| 1 | +# Running S3 Specs from OCI image (Docker or Podman) |
| 2 | + |
| 3 | +## 1. Create a config file with your endpoints and credentials, |
| 4 | +following the yaml format in profiles.example.yaml |
| 5 | + |
| 6 | +```bash |
| 7 | +wget https://raw.githubusercontent.com/MagaluCloud/s4-specs/refs/heads/main/params.example.yaml -O params.yaml |
| 8 | +vim params.yaml |
| 9 | +# Edit to add this values on the number of profiles your tests needs |
| 10 | +# (policy and acl tests for example needs 2 different profiles): |
| 11 | +# region_name: "br-ne1" |
| 12 | +# endpoint_url: "https://br-se1.magaluobjects.com/" |
| 13 | +# aws_access_key_id: "YOUR-KEY-ID-HERE" |
| 14 | +# aws_secret_access_key: "YOUR-SECRET-KEY-HERE" |
| 15 | +``` |
| 16 | + |
| 17 | +### 1.1. Optional: build the image locally |
| 18 | + |
| 19 | +If you cloned the repo and want to build the image locally instead of using the published ones, |
| 20 | +use the Containerfiles under the `oci` folder: |
| 21 | + |
| 22 | +```bash |
| 23 | +IMAGE_NAME=myimage podman build -t "$IMAGE_NAME" -f ./oci/full.Containerfile . |
| 24 | +``` |
| 25 | + |
| 26 | +## 2. Run all tests (this might take several minutes) |
| 27 | + |
| 28 | +```bash |
| 29 | +# $IMAGE_NAME is the local tag name, if you build the Containerfile yourself, |
| 30 | +# or the published one like https://ghcr.io/magalucloud/s3-specs:full |
| 31 | +# |
| 32 | +# all examples can be run with docker as well |
| 33 | +podman run -t \ |
| 34 | + -v $(realpath params.yaml):/app/params.example.yaml \ |
| 35 | + "$IMAGE_NAME" tests \ |
| 36 | + -n auto |
| 37 | +``` |
| 38 | + |
| 39 | +> ::note:: Whatever comes after the image name (`-n auto` in the example above) |
| 40 | +are pytest arguments, see `oci/entrypoint.sh` for details. The next examples are |
| 41 | +variations of test filters using the markers feature of pytest (`-m` argument). |
| 42 | + |
| 43 | +## 3. Run all tests, excluding specific categories |
| 44 | + |
| 45 | +In following example we use the `-m` arg with the `not` operator to exclude two categories: |
| 46 | + |
| 47 | +```bash |
| 48 | +podman run -t \ |
| 49 | + -v $(realpath params.yaml):/app/params.example.yaml \ |
| 50 | + "$IMAGE_NAME" tests \ |
| 51 | + -n auto -m "not locking not slow" |
| 52 | +``` |
| 53 | + |
| 54 | +## 4. Run only some specific categories |
| 55 | + |
| 56 | +You can pass pytest arguments to the image entrypoint, for example, you can filter tests of |
| 57 | +specific categories, using the `-m` arg for markers, like: |
| 58 | + |
| 59 | +```bash |
| 60 | +podman run -t \ |
| 61 | + -v $(realpath params.yaml):/app/params.example.yaml \ |
| 62 | + "$IMAGE_NAME" tests \ |
| 63 | + -n auto -m "basic cold_storage" |
| 64 | +``` |
| 65 | + |
| 66 | +## 5. Run generating reports |
| 67 | + |
| 68 | +You can generate reports of the tests using the following command: |
| 69 | + |
| 70 | +```bash |
| 71 | +podman run -t \ |
| 72 | + -v $(realpath .):/app/reports/outputs \ |
| 73 | + -v $(realpath params.yaml):/app/params.example.yaml \ |
| 74 | + "$IMAGE_NAME" reports \ |
| 75 | + category_of_tests |
| 76 | +``` |
| 77 | + |
| 78 | +To execute this command you need to pass a category of tests you want to running. The possibles categories are: |
| 79 | + |
| 80 | +- full: execute all the tests |
| 81 | +- versioning: execute versioning tests |
| 82 | +- basic: execute basic tests (included acl, list, presigned url and bucketname) |
| 83 | +- policy: execute policies tests |
| 84 | +- cold: execute cold storage tests |
| 85 | +- locking: execute locking tests |
| 86 | +- big-objects: execute big-objects tests |
0 commit comments