File tree Expand file tree Collapse file tree 4 files changed +14
-28
lines changed
Expand file tree Collapse file tree 4 files changed +14
-28
lines changed Original file line number Diff line number Diff line change 1+
12version : " 3"
23
34vars :
1011 go list ./... | tr '\n' ' ' ||
1112 echo '"ERROR: Unable to discover Go packages"'
1213 )
14+ # `-ldflags` flag to use for `go build` command
15+ # TODO: define flag if required by the project, or leave empty if not needed.
16+ LDFLAGS :
1317
1418tasks :
1519 # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/check-go-task/Taskfile.yml
@@ -44,5 +48,12 @@ tasks:
4448 desc : Run unit tests
4549 dir : " {{default .DEFAULT_GO_MODULE_PATH .GO_MODULE_PATH}}"
4650 cmds :
47- - docker build -f testdata/Dockerfile -t go-apt-test:latest .
48- - docker run --rm -v "$PWD":/app go-apt-test -v -short -run '{{default ".*" .GO_TEST_REGEX}}' {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} -coverprofile=coverage_unit.txt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
51+ - |
52+ go test \
53+ -v \
54+ -short \
55+ -run '{{default ".*" .GO_TEST_REGEX}}' \
56+ {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} \
57+ -coverprofile=coverage_unit.txt \
58+ {{.TEST_LDFLAGS}} \
59+ {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ func parseDpkgQueryOutput(out []byte) []*Package {
8686
8787// CheckForUpdates runs an apt update to retrieve new packages available
8888// from the repositories
89+ // NOTE: it requires root privileges to run
8990func CheckForUpdates () (output []byte , err error ) {
9091 cmd := exec .Command ("apt-get" , "update" , "-q" )
9192 return cmd .CombinedOutput ()
Original file line number Diff line number Diff line change @@ -63,13 +63,6 @@ func TestListUpgradable(t *testing.T) {
6363 require .NoError (t , err , "running List command" )
6464}
6565
66- func TestCheckForUpdates (t * testing.T ) {
67- out , err := CheckForUpdates ()
68- require .NoError (t , err , "running CheckForUpdate command" )
69- fmt .Printf (">>>\n %s\n <<<\n " , string (out ))
70- fmt .Println ("ERR:" , err )
71- }
72-
7366func TestParseListUpgradableOutput (t * testing.T ) {
7467 t .Run ("edges cases" , func (t * testing.T ) {
7568 tests := []struct {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments