Skip to content

Commit

Permalink
add canceled status for CreateIndex api
Browse files Browse the repository at this point in the history
integrate multiple test functions
remove unneccessary testing
fix
fix
fix failed searchByID test
rename and refactor buildIndex()
fix

Signed-off-by: kpango <kpango@vdaas.org>
  • Loading branch information
kpango committed Dec 26, 2022
1 parent cad800c commit 60a5c06
Show file tree
Hide file tree
Showing 50 changed files with 4,806 additions and 4,948 deletions.
20 changes: 20 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ GOBIN := $(eval GOBIN := $(shell go env GOBIN))$(GOBIN)
GOCACHE := $(eval GOCACHE := $(shell go env GOCACHE))$(GOCACHE)
GOOS := $(eval GOOS := $(shell go env GOOS))$(GOOS)
GOPATH := $(eval GOPATH := $(shell go env GOPATH))$(GOPATH)
GOTEST_TIMEOUT = 30m

TEMP_DIR := $(eval TEMP_DIR := $(shell mktemp -d))$(TEMP_DIR)

Expand Down Expand Up @@ -376,6 +377,8 @@ update: \
format: \
license \
format/go \
format/json \
format/md \
format/yaml

.PHONY: format/go
Expand All @@ -399,6 +402,23 @@ format/yaml: \
"cmd/**/*.yaml" \
"k8s/**/*.yaml"

.PHONY: format/md
format/md: \
prettier/install
prettier --write \
"charts/**/*.md" \
"apis/**/*.md" \
"tests/**/*.md" \
"./*.md"

.PHONY: format/json
format/json: \
prettier/install
prettier --write \
"apis/**/*.json" \
"charts/**/*.json" \
"hack/**/*.json"

.PHONY: deps
## resolve dependencies
deps: \
Expand Down
38 changes: 19 additions & 19 deletions Makefile.d/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ $(GOPATH)bin/gotests:

## run tests for cmd, internal, pkg
test:
go test -shuffle=on -race -mod=readonly -cover -timeout=30m ./cmd/... ./internal/... ./pkg/...
go test -short -shuffle=on -race -mod=readonly -cover -timeout=$(GOTEST_TIMEOUT) ./cmd/... ./internal/... ./pkg/...

.PHONY: test/tparse
## run tests for cmd, internal, pkg and show table
test/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./cmd/... ./internal/... ./pkg/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./cmd/... ./internal/... ./pkg/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| tparse -pass -notests

Expand All @@ -60,7 +60,7 @@ test/cmd/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./cmd/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./cmd/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| tparse -pass -notests

Expand All @@ -70,7 +70,7 @@ test/internal/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./internal/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./internal/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| tparse -pass -notests

Expand All @@ -80,7 +80,7 @@ test/pkg/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./pkg/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./pkg/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| tparse -pass -notests

Expand All @@ -90,7 +90,7 @@ test/hack/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover \
go test -short -shuffle=on -race -mod=readonly -json -cover \
./hack/gorules/... \
./hack/helm/... \
./hack/license/... \
Expand All @@ -104,7 +104,7 @@ test/all/tparse: \
tparse/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| tparse -pass -notests

Expand All @@ -114,7 +114,7 @@ test/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./cmd/... ./internal/... ./pkg/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./cmd/... ./internal/... ./pkg/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| gotestfmt -showteststatus

Expand All @@ -124,7 +124,7 @@ test/cmd/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./cmd/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./cmd/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| gotestfmt -showteststatus

Expand All @@ -134,7 +134,7 @@ test/internal/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./internal/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./internal/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| gotestfmt -showteststatus

Expand All @@ -144,7 +144,7 @@ test/pkg/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./pkg/... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./pkg/... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| gotestfmt -showteststatus

Expand All @@ -154,7 +154,7 @@ test/hack/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover \
go test -short -shuffle=on -race -mod=readonly -json -cover \
./hack/gorules/... \
./hack/helm/... \
./hack/license/... \
Expand All @@ -168,29 +168,29 @@ test/all/gotestfmt: \
gotestfmt/install
set -euo pipefail
rm -rf "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json"
go test -shuffle=on -race -mod=readonly -json -cover -timeout=30m ./... \
go test -short -shuffle=on -race -mod=readonly -json -cover -timeout=$(GOTEST_TIMEOUT) ./... \
| tee "$(TEST_RESULT_DIR)/`echo $@ | sed -e 's%/%-%g'`-result.json" \
| gotestfmt -showteststatus

.PHONY: test/pkg
## run tests for pkg
test/pkg:
go test -shuffle=on -race -mod=readonly -cover ./pkg/...
go test -short -shuffle=on -race -mod=readonly -cover ./pkg/...

.PHONY: test/internal
## run tests for internal
test/internal:
go test -shuffle=on -race -mod=readonly -cover ./internal/...
go test -short -shuffle=on -race -mod=readonly -cover ./internal/...

.PHONY: test/cmd
## run tests for cmd
test/cmd:
go test -shuffle=on -race -mod=readonly -cover ./cmd/...
go test -short -shuffle=on -race -mod=readonly -cover ./cmd/...

.PHONY: test/hack
## run tests for hack
test/hack:
go test -shuffle=on -race -mod=readonly -cover \
go test -short -shuffle=on -race -mod=readonly -cover \
./hack/gorules... \
./hack/helm/... \
./hack/license/...\
Expand All @@ -199,12 +199,12 @@ test/hack:
.PHONY: test/all
## run tests for all Go codes
test/all:
go test -shuffle=on -race -mod=readonly -cover ./...
go test -short -shuffle=on -race -mod=readonly -cover ./...

.PHONY: coverage
## calculate coverages
coverage:
go test -shuffle=on -race -mod=readonly -v -race -covermode=atomic -timeout=30m -coverprofile=coverage.out ./...
go test -short -shuffle=on -race -mod=readonly -v -race -covermode=atomic -timeout=$(GOTEST_TIMEOUT) -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html

.PHONY: gotests/gen
Expand Down
Loading

0 comments on commit 60a5c06

Please sign in to comment.