Skip to content

Commit

Permalink
keeping the assert function for other PR
Browse files Browse the repository at this point in the history
Signed-off-by: Feny Mehta <[email protected]>
  • Loading branch information
fbm3307 committed Jan 7, 2025
1 parent 8721a30 commit 299e1fd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/nstemplatetier/assertions.go
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

Check failure on line 15 in test/nstemplatetier/assertions.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint

field `tier` is unused (unused)
client runtimeclient.Client
namespacedName types.NamespacedName
t test.T
}

func (a *Assertion) loadResource() error {

Check failure on line 21 in test/nstemplatetier/assertions.go

View workflow job for this annotation

GitHub Actions / GolangCI Lint

func `(*Assertion).loadResource` is unused (unused)
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,
}
}

0 comments on commit 299e1fd

Please sign in to comment.