platform9 / cctl

Apache License 2.0
47 stars 8 forks source link

Add unit test target to the Makefile #126

Closed vannrt closed 6 years ago

vannrt commented 6 years ago

pushd pkg/migrate && \
  go test -v && \
    popd
~/go/src/github.com/platform9/cctl/pkg/migrate ~/go/src/github.com/platform9/cctl
=== RUN   TestMigrateV0toV1
=== RUN   TestMigrateV0toV1/Update_schemaVersion_to_1
=== RUN   TestMigrateV0toV1/Cannot_update_schemaVersion_>_1
=== RUN   TestMigrateV0toV1/Update_same_schemaVersion
--- PASS: TestMigrateV0toV1 (0.00s)
    --- PASS: TestMigrateV0toV1/Update_schemaVersion_to_1 (0.00s)
    --- PASS: TestMigrateV0toV1/Cannot_update_schemaVersion_>_1 (0.00s)
    --- PASS: TestMigrateV0toV1/Update_same_schemaVersion (0.00s)
PASS
ok      github.com/platform9/cctl/pkg/migrate   0.058s
~/go/src/github.com/platform9/cctl```
dlipovetsky commented 6 years ago

This fails:

$ make unit-test
pushd pkg/migrate && \
go test -v && \
popd
~/go/src/github.com/platform9/cctl/pkg/migrate ~/go/src/github.com/platform9/cctl
# github.com/platform9/cctl/pkg/migrate
migrate_v1_test.go:5:2: cannot find package "github.com/platform9/cctl/pkg/util/migrate" in any of:
        /home/daniel/go/src/github.com/platform9/cctl/vendor/github.com/platform9/cctl/pkg/util/migrate (vendor tree)
        /home/daniel/go/1.10.4/src/github.com/platform9/cctl/pkg/util/migrate (from $GOROOT)
        /home/daniel/go/src/github.com/platform9/cctl/pkg/util/migrate (from $GOPATH)
FAIL    github.com/platform9/cctl/pkg/migrate [setup failed]
make: *** [Makefile:54: unit-test] Error 1

The issue is that the migrate_v1_test.go tries to import the migrate package, even though it is in the migrate package. How did you make this pass?

I submitted #129 with a fix for this and another issue.

vannrt commented 6 years ago

@dlipovetsky I forgot to mention that this depends on https://github.com/platform9/cctl/pull/125. Without that, this won't pass.