Skip to content

Commit

Permalink
Merge pull request #4 from Dalee/coverage
Browse files Browse the repository at this point in the history
Coverage
  • Loading branch information
arkady-emelyanov authored Feb 15, 2017
2 parents b6ed401 + 2a6821c commit 0584b9b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,22 @@ if you want.
* Golang >= 1.7.x
* [golint](https://github.com/golang/lint)
* [glide](https://github.com/Masterminds/glide)
* [gover](https://github.com/modocache/gover)
* make


Install developer dependencies:
```
$ go get -u github.com/modocache/gover && \
go get -u github.com/golang/lint/golint && \
go get -u github.com/Masterminds/glide
```
$ glide install
... work work work

$ make test && make lint
Install project dependencies:
```
$ glide install
```

Test and Coverage
* `make test` — linting and testing
* `make coverage && go tool cover -html=coverage.out` — see coverage
30 changes: 29 additions & 1 deletion pkg/kubectl/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import (
"github.com/stretchr/testify/assert"
)

func TestReplicaSet_GetImages(t *testing.T) {
func TestReplicaSet_Types(t *testing.T) {
rs := ReplicaSet{
Kind: "ReplicaSet",
Metadata: kubeTypeMetadata{
Name: "test-replicaset-42",
Namespace: "default",
},
Spec: kubeTypeResourceSpec{
Template: kubeTypeTemplate{
Spec: kubeTypeSpec{
Expand All @@ -20,5 +25,28 @@ func TestReplicaSet_GetImages(t *testing.T) {
},
}

assert.Equal(t, "test-replicaset-42", rs.GetName())
assert.Equal(t, "replicaset", rs.GetKind())
assert.Equal(t, []string{"registry.example.com/example/repo:1"}, rs.GetImages())
}

func TestDeployment_Types(t *testing.T) {
d := Deployment{
Kind: "Deployment",
Metadata: kubeTypeMetadata{
Name: "test-deployment",
Namespace: "default",
},
}

assert.Equal(t, "test-deployment", d.GetName())
assert.Equal(t, "deployment", d.GetKind())
}

func TestKubeResourceList_Types(t *testing.T) {
rl := kubeResourceList{
Kind: "List",
}

assert.Equal(t, "list", rl.GetKind())
}

0 comments on commit 0584b9b

Please sign in to comment.