Skip to content

Commit

Permalink
add tests for creation time
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed Jun 10, 2019
1 parent ca4b454 commit d569605
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/kube/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/reactiveops/polaris/test"
"github.com/stretchr/testify/assert"
"testing"
"time"
)

func TestGetResourcesFromPath(t *testing.T) {
Expand All @@ -14,6 +15,7 @@ func TestGetResourcesFromPath(t *testing.T) {
assert.Equal(t, "Path", resources.SourceType, "Should have type Path")
assert.Equal(t, "./test_files/test_1", resources.SourceName, "Should have filename as name")
assert.Equal(t, "unknown", resources.ServerVersion, "Server version should be unknown")
assert.IsType(t, time.Now(), resources.CreationTime, "Creation time should be set")

assert.Equal(t, 0, len(resources.Nodes), "Should not have any nodes")

Expand All @@ -36,6 +38,7 @@ func TestGetMultipleResourceFromSingleFile(t *testing.T) {
assert.Equal(t, "Path", resources.SourceType, "Should have type Path")
assert.Equal(t, "./test_files/test_2/multi.yaml", resources.SourceName, "Should have filename as name")
assert.Equal(t, "unknown", resources.ServerVersion, "Server version should be unknown")
assert.IsType(t, time.Now(), resources.CreationTime, "Creation time should be set")

assert.Equal(t, 0, len(resources.Nodes), "Should not have any nodes")

Expand All @@ -55,6 +58,7 @@ func TestGetResourceFromAPI(t *testing.T) {

assert.Equal(t, "Cluster", resources.SourceType, "Should have type Path")
assert.Equal(t, "test", resources.SourceName, "Should have source name")
assert.IsType(t, time.Now(), resources.CreationTime, "Creation time should be set")

assert.Equal(t, 0, len(resources.Nodes), "Should not have any nodes")
assert.Equal(t, 1, len(resources.Deployments), "Should have a deployment")
Expand Down

0 comments on commit d569605

Please sign in to comment.