-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keeping the assert function for other PR
Signed-off-by: Feny Mehta <[email protected]>
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package nstemplatetier | ||
|
||
import ( | ||
"context" | ||
|
||
toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1" | ||
"github.com/codeready-toolchain/toolchain-common/pkg/test" | ||
|
||
"k8s.io/apimachinery/pkg/types" | ||
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
// Assertion an assertion helper for an NSTemplateTier | ||
type Assertion struct { | ||
tier *toolchainv1alpha1.NSTemplateTier | ||
client runtimeclient.Client | ||
namespacedName types.NamespacedName | ||
t test.T | ||
} | ||
|
||
func (a *Assertion) loadResource() error { | ||
tier := &toolchainv1alpha1.NSTemplateTier{} | ||
err := a.client.Get(context.TODO(), a.namespacedName, tier) | ||
a.tier = tier | ||
return err | ||
} | ||
|
||
// AssertThatNSTemplateTier helper func to begin with the assertions on an NSTemplateTier | ||
func AssertThatNSTemplateTier(t test.T, name string, client runtimeclient.Client) *Assertion { | ||
return &Assertion{ | ||
client: client, | ||
namespacedName: test.NamespacedName(test.HostOperatorNs, name), | ||
t: t, | ||
} | ||
} |