Skip to content

Commit

Permalink
Swap out minio for GoFakeS3 in .bazelci/system-test.sh
Browse files Browse the repository at this point in the history
Let's see if this makes .bazelci/system-test.sh pass again with
the tip of bazel's main branch.

These tests also seem to run much faster now (~3m vs ~30min before).

Relates to #672.
  • Loading branch information
mostynb committed Jul 29, 2023
1 parent 0c0a1b3 commit 5aa8ae1
Show file tree
Hide file tree
Showing 7 changed files with 180 additions and 46 deletions.
56 changes: 20 additions & 36 deletions .bazelci/system-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,15 @@ EXTRA_FLAGS_DESC=""

summary=""

### Begin minio setup.
### Begin fakes3 setup.

if [ ! -e minio ]
then
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
fi
if [ ! -e mc ]
then
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
fi

rm -rf miniocachedir
for p in $(pidof minio)
do
kill -HUP $p && sleep 2 || true
done
./minio server miniocachedir &
minio_pid=$!
# Copy the binary somewhere known, so we can run it manually.
bazel run --run_under "cp -f " //utils/fakes3 $(pwd)/
./fakes3 &
fakes3_pid=$!
sleep 2
./mc config host add myminio http://127.0.0.1:9000 minioadmin minioadmin
./mc mb myminio/bazel-remote

### End minio setup.
### End fakes3 setup.

wait_for_startup() {
server_pid="$1"
Expand Down Expand Up @@ -98,8 +82,8 @@ rm -rf $test_cache_dir
--s3.bucket bazel-remote \
--s3.prefix files \
--s3.auth_method access_key \
--s3.access_key_id minioadmin \
--s3.secret_access_key minioadmin \
--s3.access_key_id fakes3id \
--s3.secret_access_key fakes3key \
--s3.disable_ssl \
--s3.update_timestamps \
> log.stdout 2> log.stderr &
Expand All @@ -109,7 +93,7 @@ wait_for_startup "$test_cache_pid"

bazel clean 2> /dev/null

echo -n "Build with cold cache (HTTP, populating minio): "
echo -n "Build with cold cache (HTTP, populating fakes3): "
ti=$(date +%s)
bazel build //:bazel-remote "--remote_cache=http://127.0.0.1:$HTTP_PORT" \
2> http_cold
Expand Down Expand Up @@ -156,8 +140,8 @@ rm -rf $test_cache_dir
--s3.bucket bazel-remote \
--s3.prefix files \
--s3.auth_method access_key \
--s3.access_key_id minioadmin \
--s3.secret_access_key minioadmin \
--s3.access_key_id fakes3id \
--s3.secret_access_key fakes3key \
--s3.disable_ssl \
--s3.update_timestamps \
> log.stdout 2> log.stderr &
Expand All @@ -167,18 +151,18 @@ wait_for_startup "$test_cache_pid"

bazel clean 2> /dev/null

testsection="cold HTTP, hot minio"
testsection="cold HTTP, hot fakes3"
echo -n "Build with hot cache ($testsection): "
ti=$(date +%s)
bazel build //:bazel-remote "--remote_cache=http://127.0.0.1:$HTTP_PORT" \
--execution_log_json_file=http_hot_minio.json \
--execution_log_json_file=http_hot_fakes3.json --verbose_failures \
2> http_hot
tf=$(date +%s)
duration=$(expr $tf - $ti)
echo "${duration}s"
grep process http_hot
hits=$(grep -c '"remoteCacheHit": true,' http_hot_minio.json || true) # TODO: replace these with jq one day.
misses=$(grep -c '"remoteCacheHit": false,' http_hot_minio.json || true)
hits=$(grep -c '"remoteCacheHit": true,' http_hot_fakes3.json || true) # TODO: replace these with jq one day.
misses=$(grep -c '"remoteCacheHit": false,' http_hot_fakes3.json || true)
hit_rate=$(awk -vhits=$hits -vmisses=$misses 'BEGIN { printf "%0.2f", hits*100/(hits+misses) }' </dev/null)
result=$(awk -vhit_rate=$hit_rate -vmin=$min_acceptable_hit_rate 'BEGIN {if (hit_rate >= min) print "success" ; else print "failure";}' < /dev/null)
[ "$result" = "failure" ] && overall_result=failure
Expand Down Expand Up @@ -235,8 +219,8 @@ rm -rf $test_cache_dir
--s3.bucket bazel-remote \
--s3.prefix files \
--s3.auth_method access_key \
--s3.access_key_id minioadmin \
--s3.secret_access_key minioadmin \
--s3.access_key_id fakes3id \
--s3.secret_access_key fakes3key \
--s3.disable_ssl \
--s3.update_timestamps \
> log.stdout 2> log.stderr &
Expand All @@ -246,7 +230,7 @@ wait_for_startup "$test_cache_pid"

bazel clean 2> /dev/null

testsection="cold gRPC, hot minio"
testsection="cold gRPC, hot fakes3"
echo -n "Build with hot cache ($testsection): "
ti=$(date +%s)
bazel build //:bazel-remote --remote_cache=grpc://127.0.0.1:9092 \
Expand All @@ -266,8 +250,8 @@ summary+="\n$testsection: hit rate: ${hit_rate}% (hits: $hits misses: $misses) =

kill -9 $test_cache_pid

echo "Stopping minio"
kill -9 $minio_pid
echo "Stopping fakes3"
kill -9 $fakes3_pid

echo -e "\n##########"
echo -e "$summary\n"
Expand Down
65 changes: 64 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,70 @@ load("//:deps.bzl", "go_dependencies")
# gazelle:repository_macro deps.bzl%go_dependencies
go_dependencies()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

go_repository(
name = "com_github_aws_aws_sdk_go",
importpath = "github.com/aws/aws-sdk-go",
sum = "h1:O8VH+bJqgLDguqkH/xQBFz5o/YheeZqgcOYIgsTVWY4=",
version = "v1.44.256",
)

go_repository(
name = "com_github_jmespath_go_jmespath",
importpath = "github.com/jmespath/go-jmespath",
sum = "h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=",
version = "v0.4.0",
)

go_repository(
name = "com_github_jmespath_go_jmespath_internal_testify",
importpath = "github.com/jmespath/go-jmespath/internal/testify",
sum = "h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=",
version = "v1.5.1",
)

go_repository(
name = "com_github_johannesboyne_gofakes3",
importpath = "github.com/johannesboyne/gofakes3",
sum = "h1:O7syWuYGzre3s73s+NkgB8e0ZvsIVhT/zxNU7V1gHK8=",
version = "v0.0.0-20230506070712-04da935ef877",
)

go_repository(
name = "com_github_ryszard_goskiplist",
importpath = "github.com/ryszard/goskiplist",
sum = "h1:GHRpF1pTW19a8tTFrMLUcfWwyC0pnifVo2ClaLq+hP8=",
version = "v0.0.0-20150312221310-2dfbae5fcf46",
)

go_repository(
name = "com_github_shabbyrobe_gocovmerge",
importpath = "github.com/shabbyrobe/gocovmerge",
sum = "h1:WnNuhiq+FOY3jNj6JXFT+eLN3CQ/oPIsDPRanvwsmbI=",
version = "v0.0.0-20190829150210-3e036491d500",
)

go_repository(
name = "com_github_spf13_afero",
importpath = "github.com/spf13/afero",
sum = "h1:qgMbHoJbPbw579P+1zVY+6n4nIFuIchaIjzZ/I/Yq8M=",
version = "v1.2.1",
)

go_repository(
name = "in_gopkg_mgo_v2",
importpath = "gopkg.in/mgo.v2",
sum = "h1:xcEWjVhvbDy+nHP67nPDDpbYrY+ILlfndk4bRioVHaU=",
version = "v2.0.0-20180705113604-9856a29383ce",
)

go_repository(
name = "io_etcd_go_bbolt",
importpath = "go.etcd.io/bbolt",
sum = "h1:XAzx9gjCb0Rxj7EoqcClPD1d5ZBxZJk0jbuoPHenBt0=",
version = "v1.3.5",
)

gazelle_dependencies()

Expand Down
16 changes: 8 additions & 8 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,8 @@ def go_dependencies():
go_repository(
name = "com_github_yuin_goldmark",
importpath = "github.com/yuin/goldmark",
sum = "h1:5tjfNdR2ki3yYQ842+eX2sQHeiwpKJ0RnHO4IYOc4V8=",
version = "v1.1.32",
sum = "h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=",
version = "v1.4.13",
)
go_repository(
name = "com_google_cloud_go",
Expand Down Expand Up @@ -1668,8 +1668,8 @@ def go_dependencies():
go_repository(
name = "org_golang_x_mod",
importpath = "golang.org/x/mod",
sum = "h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=",
version = "v0.9.0",
sum = "h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=",
version = "v0.10.0",
)
go_repository(
name = "org_golang_x_net",
Expand All @@ -1686,8 +1686,8 @@ def go_dependencies():
go_repository(
name = "org_golang_x_sync",
importpath = "golang.org/x/sync",
sum = "h1:cu5kTvlzcw1Q5S9f5ip1/cpiB4nXvw1XYzFPGgzLUOY=",
version = "v0.0.0-20220929204114-8fcdb60fdcc0",
sum = "h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=",
version = "v0.1.0",
)
go_repository(
name = "org_golang_x_sys",
Expand Down Expand Up @@ -1716,8 +1716,8 @@ def go_dependencies():
go_repository(
name = "org_golang_x_tools",
importpath = "golang.org/x/tools",
sum = "h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=",
version = "v0.6.0",
sum = "h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y=",
version = "v0.8.0",
)
go_repository(
name = "org_golang_x_xerrors",
Expand Down
7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/slok/go-http-metrics v0.10.0
github.com/urfave/cli/v2 v2.17.1
golang.org/x/oauth2 v0.6.0
golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0
golang.org/x/sync v0.1.0
golang.org/x/sys v0.10.0 // indirect
google.golang.org/genproto v0.0.0-20230525234025-438c736192d0
google.golang.org/grpc v1.55.0
Expand All @@ -41,13 +41,15 @@ require (
cloud.google.com/go/longrunning v0.4.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect
github.com/aws/aws-sdk-go v1.44.256 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/golang-jwt/jwt v3.2.1+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/johannesboyne/gofakes3 v0.0.0-20230506070712-04da935ef877 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
Expand All @@ -62,11 +64,14 @@ require (
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryszard/goskiplist v0.0.0-20150312221310-2dfbae5fcf46 // indirect
github.com/shabbyrobe/gocovmerge v0.0.0-20190829150210-3e036491d500 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/tools v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)
Expand Down
Loading

0 comments on commit 5aa8ae1

Please sign in to comment.