Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
fix(clean-buckets):adjusts to make execution from docker image work
Browse files Browse the repository at this point in the history
  • Loading branch information
fczuardi committed Nov 24, 2023
1 parent 541b444 commit ab5906e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ list-tests:
| sed "s/\.js//g"

# clean test buckets
clean-buckets profile:
clean-buckets profile: _setup
./src/k6/utils/clean-buckets.py {{profile}}

# Test a S3-compatible provider with k6
Expand Down Expand Up @@ -103,7 +103,7 @@ run *args:
touch mgc
{{oci_manager}} run \
--volume ${PWD}/results:/app/results \
--volume ${PWD}/config.yaml:/app/config.yaml \
--volume ${PWD}/config.yaml:/app/config.yaml:z \
--volume ${PWD}/mgc:/usr/bin/mgc \
--env "CONFIG_PATH=/app/" \
{{main_image}} {{args}}
Expand Down
4 changes: 3 additions & 1 deletion src/k6/utils/clean-buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import boto3
import sys
import yaml
import os

config_file = os.path.join(os.getenv('CONFIG_PATH', '.'), 'config.yaml')

def delete_bucket_contents(s3, bucket_name):
objects = s3.list_objects_v2(Bucket=bucket_name)
Expand All @@ -11,7 +13,7 @@ def delete_bucket_contents(s3, bucket_name):
s3.delete_object(Bucket=bucket_name, Key=obj['Key'])

def delete_buckets(profile):
with open("config.yaml", "r") as stream:
with open(config_file, "r") as stream:
try:
data = yaml.safe_load(stream)
endpoint = data['remotes'][profile]['s3']['endpoint']
Expand Down

0 comments on commit ab5906e

Please sign in to comment.