From c063a7f4d071fee2b34f4da9114c4b5c44b2b291 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Fri, 10 Jan 2020 17:14:09 +0530 Subject: [PATCH 1/8] Run all test on CI --- db_test.go | 8 +------- test.sh | 10 +++++++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/db_test.go b/db_test.go index f6185e44c..56c95de98 100644 --- a/db_test.go +++ b/db_test.go @@ -26,7 +26,6 @@ import ( "log" "math" "math/rand" - "net/http" "os" "path/filepath" "runtime" @@ -1957,12 +1956,7 @@ func TestVerifyChecksum(t *testing.T) { } func TestMain(m *testing.M) { - // call flag.Parse() here if TestMain uses flags - go func() { - if err := http.ListenAndServe("localhost:8080", nil); err != nil { - panic("Unable to open http port at 8080") - } - }() + flag.Parse() os.Exit(m.Run()) } diff --git a/test.sh b/test.sh index 90d21889c..9299c7ca4 100755 --- a/test.sh +++ b/test.sh @@ -25,9 +25,13 @@ rm -rf p echo echo "==> Starting tests with value log mmapped..." sleep 5 -go test -v --vlog_mmap=true -race ./... - +# Run top level package tests with mmap flag. +go test -v --vlog_mmap=true -race github.com/dgraph-io/badger/v2 echo echo "==> Starting tests with value log not mmapped..." sleep 5 -go test -v --vlog_mmap=false -race ./... +go test -v --vlog_mmap=false -race github.com/dgraph-io/badger/v2 + +# Run test for rest of the packages. +go test -v -race $(go list ./... | grep github.com/dgraph-io/badger/v2/.) + From 3b49132a7c3486b7d9cc7da30db025d993860201 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Fri, 10 Jan 2020 18:23:17 +0530 Subject: [PATCH 2/8] Reorder tests --- test.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test.sh b/test.sh index 9299c7ca4..bed65d05b 100755 --- a/test.sh +++ b/test.sh @@ -22,6 +22,13 @@ go test -v --manual=true -run='TestTruncateVlogNoClose3$' . rm -rf p # Then the normal tests. +echo +echo "==> Starting test for table, skl and y package" +sleep 5 +# Run test for all package except the top level packge. The top level package support the +# `vlog_mmap` flag which rest of the packages don't support. +go test -v -race $(go list ./... | grep github.com/dgraph-io/badger/v2/. | tr -d '"') + echo echo "==> Starting tests with value log mmapped..." sleep 5 @@ -32,6 +39,3 @@ echo "==> Starting tests with value log not mmapped..." sleep 5 go test -v --vlog_mmap=false -race github.com/dgraph-io/badger/v2 -# Run test for rest of the packages. -go test -v -race $(go list ./... | grep github.com/dgraph-io/badger/v2/.) - From 6e34e0649be4e016149ad03d50a68d08f95dd8c1 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Fri, 10 Jan 2020 19:42:50 +0530 Subject: [PATCH 3/8] Attempt to fix build --- test.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test.sh b/test.sh index bed65d05b..acab09607 100755 --- a/test.sh +++ b/test.sh @@ -25,6 +25,7 @@ rm -rf p echo echo "==> Starting test for table, skl and y package" sleep 5 +go test -v -race github.com/dgraph-io/badger/v2/skl # Run test for all package except the top level packge. The top level package support the # `vlog_mmap` flag which rest of the packages don't support. go test -v -race $(go list ./... | grep github.com/dgraph-io/badger/v2/. | tr -d '"') From 5c1a074737c4b42b0319bbce4f5688cf2fca7d2b Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Mon, 13 Jan 2020 15:50:15 +0530 Subject: [PATCH 4/8] Set -json flag only for team city --- test.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test.sh b/test.sh index acab09607..e10f1b75f 100755 --- a/test.sh +++ b/test.sh @@ -4,6 +4,10 @@ set -e go version +if [[ ! -z "$TEAMCITY_VERSION" ]]; then + export GOFLAGS="-json" +fi + # Ensure that we can compile the binary. pushd badger go build -v . From 48f04b0c1b6fd2f8ecdee1707027a7f2f5cc2cdd Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Mon, 13 Jan 2020 16:59:33 +0530 Subject: [PATCH 5/8] fixup --- test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index e10f1b75f..128b66f81 100755 --- a/test.sh +++ b/test.sh @@ -4,6 +4,8 @@ set -e go version +packages=$(go list ./... | grep github.com/dgraph-io/badger/v2/) + if [[ ! -z "$TEAMCITY_VERSION" ]]; then export GOFLAGS="-json" fi @@ -32,7 +34,7 @@ sleep 5 go test -v -race github.com/dgraph-io/badger/v2/skl # Run test for all package except the top level packge. The top level package support the # `vlog_mmap` flag which rest of the packages don't support. -go test -v -race $(go list ./... | grep github.com/dgraph-io/badger/v2/. | tr -d '"') +go test -v -race $packages echo echo "==> Starting tests with value log mmapped..." From 1aa858acd57cdc61849be17377d7adf93389c09d Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Mon, 13 Jan 2020 18:02:19 +0530 Subject: [PATCH 6/8] rearrange flags --- test.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test.sh b/test.sh index 128b66f81..ed7044489 100755 --- a/test.sh +++ b/test.sh @@ -16,15 +16,15 @@ go build -v . popd # Run the memory intensive tests first. -go test -v --manual=true -run='TestBigKeyValuePairs$' -go test -v --manual=true -run='TestPushValueLogLimit' +go test -v -run='TestBigKeyValuePairs$' --manual=true +go test -v -run='TestPushValueLogLimit' --manual=true # Run the special Truncate test. rm -rf p -go test -v --manual=true -run='TestTruncateVlogNoClose$' . +go test -v -run='TestTruncateVlogNoClose$' --manual=true truncate --size=4096 p/000000.vlog -go test -v --manual=true -run='TestTruncateVlogNoClose2$' . -go test -v --manual=true -run='TestTruncateVlogNoClose3$' . +go test -v -run='TestTruncateVlogNoClose2$' --manual=true +go test -v -run='TestTruncateVlogNoClose3$' --manual=true rm -rf p # Then the normal tests. @@ -40,9 +40,9 @@ echo echo "==> Starting tests with value log mmapped..." sleep 5 # Run top level package tests with mmap flag. -go test -v --vlog_mmap=true -race github.com/dgraph-io/badger/v2 +go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=true echo echo "==> Starting tests with value log not mmapped..." sleep 5 -go test -v --vlog_mmap=false -race github.com/dgraph-io/badger/v2 +go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=false From 329f3bd92d17a949247eadc101457716b269e471 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Mon, 13 Jan 2020 20:26:42 +0530 Subject: [PATCH 7/8] Remove all sleeps --- test.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test.sh b/test.sh index ed7044489..b352d6bcf 100755 --- a/test.sh +++ b/test.sh @@ -30,7 +30,6 @@ rm -rf p # Then the normal tests. echo echo "==> Starting test for table, skl and y package" -sleep 5 go test -v -race github.com/dgraph-io/badger/v2/skl # Run test for all package except the top level packge. The top level package support the # `vlog_mmap` flag which rest of the packages don't support. @@ -38,11 +37,10 @@ go test -v -race $packages echo echo "==> Starting tests with value log mmapped..." -sleep 5 # Run top level package tests with mmap flag. go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=true + echo echo "==> Starting tests with value log not mmapped..." -sleep 5 go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=false From 04aa44cef3c515e7487f2f528066beb50d817539 Mon Sep 17 00:00:00 2001 From: Ibrahim Jarif Date: Tue, 14 Jan 2020 20:01:44 +0530 Subject: [PATCH 8/8] fix typo --- test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test.sh b/test.sh index b352d6bcf..b4e40601a 100755 --- a/test.sh +++ b/test.sh @@ -31,7 +31,7 @@ rm -rf p echo echo "==> Starting test for table, skl and y package" go test -v -race github.com/dgraph-io/badger/v2/skl -# Run test for all package except the top level packge. The top level package support the +# Run test for all package except the top level package. The top level package support the # `vlog_mmap` flag which rest of the packages don't support. go test -v -race $packages @@ -42,5 +42,5 @@ go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=true echo echo "==> Starting tests with value log not mmapped..." -go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=false +go test -v -race github.com/dgraph-io/badger/v2 --vlog_mmap=false