skybet / cali

Cali Automation Layout Initialiser
MIT License
32 stars 7 forks source link

Tests! #18

Open lucymhdavies opened 6 years ago

lucymhdavies commented 6 years ago

I'm going to make every effort to make sure that all new stuff that gets added to this is tested.

I would very much like to go through and add tests for existing stuff too.

And set this up with Travis or Circle too.

lucymhdavies commented 6 years ago

Making a start on this with https://github.com/lucymhdavies/cali/commit/705795c539d30e837d41f53f2538a9a9852713c8

Got to start somewhere, right?

edupo commented 6 years ago

https://github.com/edupo/cali/blob/master/.travis.yml It executes lot's of static analysis already...

lucymhdavies commented 6 years ago

Cool. Sounds like a good thing to have :)

I added a CircleCI config a while back, but I have no real preference for Circle over Travis, if you want to PR that in :) (I've only added precisely two tests thus far anyway)

edupo commented 6 years ago

I don't mind either. I open a PR #27 but we can port some of the test to cci but some of them may fail with the current code.

lucymhdavies commented 6 years ago

Merged your PR for Travis. :)

Build Status

We can tweak it down the line, and decide on Circle vs Travis. But this gives us something to work with.

Once it's finished, we'll see what issues it finds, and raise issues to address those.

lucymhdavies commented 6 years ago
The command "go test -v -race ./..." exited with 2.
0.86s$ go vet ./...
# github.com/skybet/cali
./task.go:87: Errorf format %s reads arg #1, but call has only 0 args
./task.go:96: Errorf format %s reads arg #1, but call has only 0 args
The command "go vet ./..." exited with 2.
21.33s$ megacheck ./...
docker.go:205:20: os.Kill cannot be trapped (did you mean syscall.SIGTERM?) (SA1016)
docker.go:241:3: should check returned error before deferring hijack.Conn.Close() (SA5001)
docker.go:322:2: should use 'return <expr>' instead of 'if <expr> { return <bool> }; return <bool>' (S1008)
docker.go:48:2: field running is unused (U1000)
The command "megacheck ./..." exited with 1.
0.01s$ gocyclo -over 19 $GO_FILES
The command "golint -set_exit_status $(go list ./...)" exited with 1.
lucymhdavies commented 6 years ago

Working on fixes for the trivial issues in https://github.com/skybet/cali/pull/35

edupo commented 6 years ago

The gocyclo was one of the hardest to fix. I just fixed it in my fork after a complete re-factor of what I understand as the Docker library cali uses to offer it's functionality.

So I suggest to disable that check until the docker part is cleaned.