forked from Snider/Poindexter
Enhance CI workflow with coverage options and add tests for KDTree functionality
This commit is contained in:
parent
054c9af39e
commit
34101cf686
3 changed files with 16 additions and 10 deletions
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
|
|
@ -44,12 +44,15 @@ jobs:
|
|||
run: |
|
||||
set -e
|
||||
for pkg in $(go list ./...); do
|
||||
if go test -list '^Fuzz' "$pkg" | grep -q '^Fuzz'; then
|
||||
echo "==> Fuzzing $pkg for 10s"
|
||||
go test -run=NONE -fuzz=Fuzz -fuzztime=10s "$pkg"
|
||||
else
|
||||
FUZZES=$(go test -list '^Fuzz' "$pkg" | grep '^Fuzz' || true)
|
||||
if [ -z "$FUZZES" ]; then
|
||||
echo "==> Skipping $pkg (no fuzz targets)"
|
||||
continue
|
||||
fi
|
||||
for fz in $FUZZES; do
|
||||
echo "==> Fuzzing $pkg :: $fz for 10s"
|
||||
go test -run=NONE -fuzz="^$fz$" -fuzztime=10s "$pkg"
|
||||
done
|
||||
done
|
||||
|
||||
- name: Upload coverage artifact
|
||||
|
|
|
|||
13
Makefile
13
Makefile
|
|
@ -73,14 +73,17 @@ coverhtml: cover ## Generate HTML coverage report at $(COVERHTML)
|
|||
.PHONY: fuzz
|
||||
fuzz: ## Run Go fuzz tests for $(FUZZTIME)
|
||||
@set -e; \
|
||||
PKGS="$$( $(GO) list ./... )"; \
|
||||
PKGS="$$($(GO) list ./...)"; \
|
||||
for pkg in $$PKGS; do \
|
||||
if $(GO) test -list '^Fuzz' $$pkg | grep -q '^Fuzz'; then \
|
||||
echo "==> Fuzzing $$pkg for $(FUZZTIME)"; \
|
||||
$(GO) test -run=NONE -fuzz=Fuzz -fuzztime=$(FUZZTIME) $$pkg; \
|
||||
else \
|
||||
FUZZES="$$($(GO) test -list '^Fuzz' $$pkg | grep '^Fuzz' || true)"; \
|
||||
if [ -z "$$FUZZES" ]; then \
|
||||
echo "==> Skipping $$pkg (no fuzz targets)"; \
|
||||
continue; \
|
||||
fi; \
|
||||
for fz in $$FUZZES; do \
|
||||
echo "==> Fuzzing $$pkg :: $$fz for $(FUZZTIME)"; \
|
||||
$(GO) test -run=NONE -fuzz="^$$fz$" -fuzztime=$(FUZZTIME) $$pkg; \
|
||||
done; \
|
||||
done
|
||||
|
||||
.PHONY: bench
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func TestDeleteByID_SwapDelete(t *testing.T) {
|
|||
if ids["B"] {
|
||||
t.Fatalf("B should not be present after delete")
|
||||
}
|
||||
if !(ids["A"] || ids["C"]) {
|
||||
if !ids["A"] && !ids["C"] {
|
||||
t.Fatalf("expected either A or C to be nearest for respective queries: %v", ids)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue