14 Commits

Author SHA1 Message Date
Ian Howell
1b8a965105 Add a simple whitespace linter
The goimports tool does not check for trailing whitespaces in multiline
strings. This commit adds a simple linter to address this deficiency.

This change will also have the benefit of providing light linting of any
non-go files.

Change-Id: I253dd7c4895f476fa3a6f0c4fccf7c9cada16366
2020-01-15 10:57:44 -06:00
Ian Howell
7ecae507e0 Add make tidy to check for up-to-date go.mod
This commit adds the `tidy` target. This target will fail if the go.mod
or go.sum files are not up to date with the code. It will also be a
prerequisite to the `lint` command, implying that it will also be caught
by the Zuul gates.

Change-Id: Ie33de2d793beca100435670346eb0e2ea7b3b0dd
2019-11-15 09:41:41 -06:00
Ian Howell
5b25f0bd00 This removes golangci-lint as a go module dependency.
golangci-lint is GPL-licensed, and its presence in go.mod might lead
people to believe that airshipctl links against a GPL-licensed
dependency. In reality airshipctl does not link against golangci-lint
(thanks to the // +build tools comment), but this change helps to avoid
that misconception from being made.

Change-Id: I95c223a7f6597e1aa07a025ed2cebbbd6bd7cbd8
2019-10-30 09:26:42 -05:00
Ian Howell
dc9c78b210 Fix the coverage tests
This fixes a bug where `make cover` was missing packages. The target now
covers all code except for code placed in the top level package (such as
main.go) and anything placed in the testutils directory.

This also fixes minor issues with the Dockerfile and the coverage_check
script

Note that this commit also strives to increase code coverage beyond the
80% margin

Change-Id: I9e1cbcf841cc869345a00f05e39774cb3da10065
2019-10-02 15:18:56 -05:00
Ian Howell
1c999e2095 Add coverage checks
This commit adds a makefile target for generating a report for unit test
coverage. It also adds the coverage_check tool to assert that the actual
test coverage meets the specified requirement.

This also improves various aspects of the testing utilities:
* The "test" package has been renamed to "testutil"
* The "Objs" member has been removed from the CmdTest object
* The "Cmd" member has been added to the CmdTest object. This allows
  testing of multiple variants of a root airshipctl command

Finally, this commit includes additional tests for root.go. These are
required in order to meet the required coverage threshold.

Change-Id: Id48343166c0488c543a405ec3143e4a75355ba43
2019-08-15 11:11:51 -05:00
Ian Howell
3cda375947 Remove dependency on k8s-code-generator
The deletions from the go.mod in this change were a relic of an earlier
change, where the k8s-code-generator was being used to generated client
code for Argo workflows. Now that Argo has been properly integrated into
the project, this is no longer needed.

These deletions were caught by a `go mod tidy`

Change-Id: I3e9f115dc31ef30dee59ddeeee513282bc555fcf
2019-07-01 12:57:29 -05:00
Ian Howell
e4b45002c9 Enable the linter, and fix uncovered linting issues
This uses the current master commit of golangci-lint. We will want to
update to use a tagged version as soon as the golangci-lint team pushes
a new tag
2019-05-30 10:02:54 -05:00
Ian Howell
615fe6c15f Add the first test for workflow init 2019-05-28 16:47:51 -05:00
Ian Howell
55a2dcb84e Add a more complex test to workflow list 2019-05-24 14:35:34 -05:00
Ian Howell
3ea070bcd5 Refrain from linting until golangci-lint issues are fixed
See the following issues:
https://github.com/golangci/golangci-lint/issues/538
https://github.com/golangci/golangci-lint/issues/539
2019-05-21 12:31:16 -05:00
Ian Howell
2624fda7f9 Remove old dependency on go-bindata 2019-05-21 12:02:39 -05:00
Ian Howell
34d0ff7e4d Remove dead code related to old plugin method 2019-05-17 14:37:30 -05:00
Ian Howell
f76eb8e027 Add a bin packer 2019-05-15 16:10:50 -05:00
Ian Howell
1d624fb05f Add a linter 2019-05-01 12:26:51 -05:00