Skip to content

Commit

Permalink
rename ks8util_test to test and add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ObiWahn committed Mar 8, 2018
1 parent ec41d32 commit 812f3ac
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 9 deletions.
26 changes: 24 additions & 2 deletions pkg/util/k8sutil/errors_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
//
// DISCLAIMER
//
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Jan Christoph Uhde
//

package k8sutil

import (
Expand All @@ -20,7 +42,7 @@ var (

func TestIsAlreadyExists(t *testing.T) {
assert.False(t, IsAlreadyExists(conflictError))
assert.False(t, IsConflict(maskAny(invalidError)))
assert.False(t, IsAlreadyExists(maskAny(invalidError)))
assert.True(t, IsAlreadyExists(existsError))
assert.True(t, IsAlreadyExists(maskAny(existsError)))
}
Expand All @@ -34,7 +56,7 @@ func TestIsConflict(t *testing.T) {

func TestIsNotFound(t *testing.T) {
assert.False(t, IsNotFound(invalidError))
assert.False(t, IsConflict(maskAny(invalidError)))
assert.False(t, IsNotFound(maskAny(invalidError)))
assert.True(t, IsNotFound(notFoundError))
assert.True(t, IsNotFound(maskAny(notFoundError)))
}
22 changes: 22 additions & 0 deletions pkg/util/k8sutil/probes_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
//
// DISCLAIMER
//
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Jan Christoph Uhde
//

package k8sutil

import (
Expand Down
29 changes: 29 additions & 0 deletions pkg/util/k8sutil/test/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// DISCLAIMER
//
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Jan Christoph Uhde
//

package test

// This package is used to resolve cyclic imports
// between k8sutil and other packages that include
// the k8sutil package. The other packages required
// by the tests as they provide implementations for
// interfaces defined by k8sutil that need to be tested.
30 changes: 23 additions & 7 deletions pkg/util/k8sutil/test/events_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
package k8sutil_test
//
// DISCLAIMER
//
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
// Author Jan Christoph Uhde
//

package test

import (
"errors"
Expand Down Expand Up @@ -56,9 +78,3 @@ func TestErrorEvent(t *testing.T) {
assert.Equal(t, event.Reason, "Reason")
assert.Equal(t, event.Type, v1.EventTypeWarning)
}

// // not accessible outside the package
// func TestDeploymentEvent(t *testing.T) {
// event := k8sutil.New("member name", "role", &apiObjectForTest)
// assert.Equal(t, event.Type, v1.EventTypeNormal)
// }

0 comments on commit 812f3ac

Please sign in to comment.