Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ go mod edit -replace=github.com/org/repo=../repo

Before any PRs are merged to main, all tests must pass.

Unit tests require Node.js. To run them, execute:
To run unit tests, execute:
```
make test-unit
```

System tests require Python 3.3 or better. To run them, execute:
System tests require Python 3.3 or better and the
[AWS CLI](https://aws.amazon.com/cli/). To run them, execute:

```
make test-system
```
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ tidy:
go mod tidy
git diff --exit-code -- go.mod go.sum

bin/minio: Makefile
@curl -fLo $@ --compressed --create-dirs \
https://dl.min.io/server/minio/release/$$(go env GOOS)-$$(go env GOARCH)/archive/minio.RELEASE.2022-05-04T07-45-27Z
@chmod +x $@

generate:
go generate ./...

Expand All @@ -48,18 +43,28 @@ test-generate: generate
test-unit:
@go test -short ./...

test-system: build bin/minio
test-system: build bin/rustfs
@ZTEST_PATH="$(CURDIR)/dist:$(CURDIR)/bin" go test .

test-boomerangs: build bin/minio
test-boomerangs: build bin/rustfs
@ZTEST_PATH="$(CURDIR)/dist:$(CURDIR)/bin" go test -parallel 1 . -run TestSPQ/boomerang -v

test-run: build bin/minio
test-run: build bin/rustfs
@ZTEST_PATH="$(CURDIR)/dist:$(CURDIR)/bin" go test . -v -run $(TEST)

test-heavy: build
@PATH="$(CURDIR)/dist:$(PATH)" go test -tags=heavy ./mdtest

bin/rustfs: Makefile
arch=$$(uname -m | sed -e s/^arm/aarch/) \
os=$$(uname -s | sed -e s/^Darwin/macos/ | tr A-Z a-z) && \
[ $$os != linux ] || libc=-musl && \
url=https://github.com/rustfs/rustfs/releases/download/1.0.0-rc.5/rustfs-$${os}-$${arch}$${libc}-latest.zip && \
echo $$url && \
curl -Lf --create-dirs -o $@.zip $$url
unzip -oq $@.zip -d $(@D)
touch -c $@

build: $(PEG_DEP)
@mkdir -p dist
@go build -ldflags='$(LDFLAGS)' -o dist ./cmd/...
Expand Down
10 changes: 6 additions & 4 deletions cmd/super/ztests/s3-multiple.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
script: |
source minio.sh
mv *.sup data/bucket
source s3.sh
aws s3api create-bucket --bucket bucket
Comment thread
mattnibs marked this conversation as resolved.
aws s3 cp --quiet log1.sup s3://bucket
aws s3 cp --quiet log2.sup s3://bucket
super -s -c "sort ts" s3://bucket/log1.sup s3://bucket/log2.sup

inputs:
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh
- name: log1.sup
data: |
{ts:2018-03-24T17:15:21.255387Z,uid:"C8Tful1TvM3Zf5x8fl"}
Expand Down
7 changes: 4 additions & 3 deletions cmd/super/ztests/s3-notexist.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
script: |
source minio.sh
source s3.sh
aws s3api create-bucket --bucket bucket
! super -s s3://bucket/does/not/exist

inputs:
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh

outputs:
- name: stderr
Expand Down
9 changes: 5 additions & 4 deletions cmd/super/ztests/s3-parquet.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
script: |
source minio.sh
mv dns.parquet data/bucket
source s3.sh
aws s3api create-bucket --bucket bucket
aws s3 cp --quiet dns.parquet s3://bucket
super -s -c "count()" s3://bucket/dns.parquet

inputs:
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh
- name: dns.parquet
source: ../../../sio/parquetio/ztests/dns.parquet

Expand Down
9 changes: 5 additions & 4 deletions cmd/super/ztests/s3-simple.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
script: |
source minio.sh
mv babble.sup ./data/bucket
source s3.sh
aws s3api create-bucket --bucket bucket
aws s3 cp --quiet babble.sup s3://bucket
super -s -c "count()" s3://bucket/babble.sup

inputs:
- name: babble.sup
source: ../../../testdata/babble.sup
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh

outputs:
- name: stdout
Expand Down
7 changes: 4 additions & 3 deletions db/ztests/s3/rm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ skip: issue 2540... need to delete by key range

script: |
mkdir logs
source minio.sh
source s3.sh
aws s3api create-bucket --bucket bucket
super db import -R logs -data s3://bucket/db babble.sup
super db map -R logs -o count.bsup "count()"
echo ===
Expand All @@ -15,8 +16,8 @@ script: |
inputs:
- name: babble.sup
source: ../../../testdata/babble.sup
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh

outputs:
- name: stdout
Expand Down
7 changes: 4 additions & 3 deletions db/ztests/s3/stat.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
script: |
source minio.sh
source s3.sh
aws s3api create-bucket --bucket bucket
export SUPER_DB=s3://bucket/db
super db init -q
super db create -q logs
Expand All @@ -9,8 +10,8 @@ script: |
inputs:
- name: babble.sup
source: ../../../testdata/babble.sup
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh

outputs:
- name: stdout
Expand Down
7 changes: 4 additions & 3 deletions db/ztests/s3/zq.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
script: |
source minio.sh
source s3.sh
aws s3api create-bucket --bucket bucket
export SUPER_DB=s3://bucket/db
super db init -q
super db create -q logs
Expand All @@ -9,8 +10,8 @@ script: |
inputs:
- name: babble.sup
source: ../../../testdata/babble.sup
- name: minio.sh
source: ../../../testdata/minio.sh
- name: s3.sh
source: ../../../testdata/s3.sh

outputs:
- name: stdout
Expand Down
18 changes: 11 additions & 7 deletions testdata/minio.sh → testdata/s3.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
#!/bin/bash

mkdir -p data/bucket
export AWS_ACCESS_KEY_ID=admin
export AWS_SECRET_ACCESS_KEY=secret

# Allocate a port. Another process could bind to it before MinIO does,
# Allocate a port. Another process could bind to it before ours does,
# but that's very unlikely.
port=$(python3 -c "import socket; print(socket.create_server(('localhost', 0)).getsockname()[1])")
minio server --address localhost:$port --console-address localhost:0 --quiet data &

dir=$PWD/s3
mkdir $dir
RUSTFS_OBS_LOG_DIRECTORY=rustfs rustfs server $dir \
--address localhost:$port --access-key $AWS_ACCESS_KEY_ID --secret-key $AWS_SECRET_ACCESS_KEY &
trap "kill -9 $!" EXIT

# Wait for MinIO to accept a connection.
# Wait for server to accept a connection.
python3 <<EOF
import socket, time
start = time.time()
Expand All @@ -22,7 +27,6 @@ while True:
time.sleep(0.1)
EOF

export AWS_ENDPOINT_URL_S3=http://localhost:$port
export AWS_REGION=does-not-matter
export AWS_ACCESS_KEY_ID=minioadmin
export AWS_SECRET_ACCESS_KEY=minioadmin
export AWS_S3_ENDPOINT=http://localhost:$port
export AWS_S3_ENDPOINT=$AWS_ENDPOINT_URL_S3
Loading