Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
celestia: scaffold unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxcanfly committed Jan 8, 2024
1 parent ccd07ef commit 2e05c57
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
go-version: ${{ inputs.GO_VERSION }}
- name: Run unit test
run: make test
run: make test-unit
- name: upload coverage report
uses: codecov/[email protected]
with:
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
LDFLAGS=-ldflags="-X '$(versioningPath).buildTime=$(shell date)' -X '$(versioningPath).lastCommit=$(shell git rev-parse HEAD)' -X '$(versioningPath).semanticVersion=$(shell git describe --tags --dirty=-dev 2>/dev/null || git rev-parse --abbrev-ref HEAD)'"

# Define pkgs, run, and cover vairables for test so that we can override them in
# Define all_pkgs, unit_pkgs, run, and cover vairables for test so that we can override them in
# the terminal more easily.
pkgs := $(shell go list ./...)
all_pkgs := $(shell go list ./...)
unit_pkgs := ./celestia
run := .
count := 1

Expand All @@ -30,7 +31,7 @@ clean:
cover:
@echo "--> Generating Code Coverage"
@go install github.com/ory/go-acc@latest
@go-acc -o coverage.txt $(pkgs)
@go-acc -o coverage.txt $(unit_pkgs)
.PHONY: cover

## deps: Install dependencies
Expand Down Expand Up @@ -63,15 +64,21 @@ fmt:
## vet: Run go vet
vet:
@echo "--> Running go vet"
@go vet $(pkgs)
@go vet $(all_pkgs)
.PHONY: vet

## test: Running unit tests
## test: Running all tests
test: vet
@echo "--> Running unit tests"
@go test -v -race -covermode=atomic -coverprofile=coverage.txt $(pkgs) -run $(run) -count=$(count)
@echo "--> Running all tests"
@go test -v -race -covermode=atomic -coverprofile=coverage.txt $(all_pkgs) -run $(run) -count=$(count)
.PHONY: test

## test: Running unit tests
test-unit: vet
@echo "--> Running unit tests"
@go test -v -race -covermode=atomic -coverprofile=coverage.txt $(unit_pkgs) -run $(run) -count=$(count)
.PHONY: test-unit

### proto-gen: Generate protobuf files. Requires docker.
#proto-gen:
# @echo "--> Generating Protobuf files"
Expand Down
9 changes: 9 additions & 0 deletions celestia/celestia_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package celestia

import (
"testing"
)

func TestCelestiaDA(t *testing.T) {
// TODO
}

0 comments on commit 2e05c57

Please sign in to comment.