Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CatherineF-dev committed Jun 28, 2023
1 parent ab98c78 commit ea97350
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions internal/discovery/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
)

// GroupVersionKindPlural is GVK + Plural
type GroupVersionKindPlural struct {
schema.GroupVersionKind
Plural string
Expand All @@ -28,6 +29,7 @@ func (g GroupVersionKindPlural) String() string {
return fmt.Sprintf("%s/%s, Kind=%s, Plural=%s", g.Group, g.Version, g.Kind, g.Plural)
}

// KindPlural is Kind + Plural
type KindPlural struct {
Kind string
Plural string
Expand Down
1 change: 1 addition & 0 deletions pkg/customresourcestate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ type ConfigDecoder interface {
Decode(v interface{}) (err error)
}

// GVKToGVKP interface implements ResolveGVKToGVKPs
type GVKToGVKP interface {
ResolveGVKToGVKPs(gvk schema.GroupVersionKind) (resolvedGVKPs []discovery.GroupVersionKindPlural, err error)
}
Expand Down
5 changes: 3 additions & 2 deletions tests/e2e/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import (
"k8s.io/klog/v2"

"k8s.io/kube-state-metrics/v2/internal"
"k8s.io/kube-state-metrics/v2/pkg/customresourcestate"
"k8s.io/kube-state-metrics/v2/pkg/options"
)

// PopulateTimeout is the timeout on populating the cache for the first time.
const PopulateTimeout = 10 * time.Second
const Interval = 3 * time.Second

func TestVariableVKsDiscoveryAndResolution(t *testing.T) {

Expand Down Expand Up @@ -140,7 +140,8 @@ func TestVariableVKsDiscoveryAndResolution(t *testing.T) {
// Wait for the metric to be available.
ch := make(chan bool, 1)
klog.InfoS("waiting for metrics to become available")
err = wait.PollUntilContextTimeout(context.TODO(), customresourcestate.Interval, PopulateTimeout, true, func(ctx context.Context) (bool, error) {

err = wait.PollUntilContextTimeout(context.TODO(), Interval, PopulateTimeout, true, func(ctx context.Context) (bool, error) {
out, err := exec.Command("curl", "localhost:8080/metrics").Output()
if err != nil {
return false, err
Expand Down

0 comments on commit ea97350

Please sign in to comment.