Skip to content

Commit

Permalink
fix some err
Browse files Browse the repository at this point in the history
  • Loading branch information
Sindweller committed Nov 17, 2021
1 parent 11e39a3 commit 60cd7b0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
6 changes: 3 additions & 3 deletions pkg/ingress/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestPodOnAdd(t *testing.T) {
controller: &Controller{
watchingNamespace: watchingNamespace,
podCache: types.NewPodCache(),
MetricsCollector: metrics.NewPrometheusCollector(),
MetricsCollector: metrics.NewPrometheusCollector(),
},
}

Expand Down Expand Up @@ -76,7 +76,7 @@ func TestPodOnDelete(t *testing.T) {
controller: &Controller{
watchingNamespace: watchingNamespace,
podCache: types.NewPodCache(),
MetricsCollector: metrics.NewPrometheusCollector(),
MetricsCollector: metrics.NewPrometheusCollector(),
},
}

Expand Down Expand Up @@ -121,7 +121,7 @@ func TestPodOnUpdate(t *testing.T) {
controller: &Controller{
watchingNamespace: watchingNamespace,
podCache: types.NewPodCache(),
MetricsCollector: metrics.NewPrometheusCollector(),
MetricsCollector: metrics.NewPrometheusCollector(),
},
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type collector struct {
controllerEvents *prometheus.CounterVec
}

// NewPrometheusCollectors creates the Prometheus metrics collector.
// NewPrometheusCollector creates the Prometheus metrics collector.
// It also registers all internal metric collector to prometheus,
// so do not call this function duplicately.
func NewPrometheusCollector() Collector {
Expand Down Expand Up @@ -222,7 +222,7 @@ func (c *collector) IncrSyncOperation(resource, result string) {
}).Inc()
}

// IncrCacheSync increases the number of cache sync operations for
// IncrCacheSyncOperation increases the number of cache sync operations for
// cluster.
func (c *collector) IncrCacheSyncOperation(result string) {
c.cacheSyncOperation.WithLabelValues(result).Inc()
Expand Down
28 changes: 15 additions & 13 deletions test/e2e/scaffold/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package scaffold
import (
"context"
"encoding/json"
"github.com/apache/apisix-ingress-controller/pkg/metrics"
"fmt"
"github.com/apache/apisix-ingress-controller/pkg/metrics"
"io/ioutil"
"net/http"
"net/url"
Expand Down Expand Up @@ -276,8 +276,9 @@ func (s *Scaffold) ListApisixUpstreams() ([]*v1.Upstream, error) {
return nil, err
}
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
return nil, err
Expand All @@ -297,8 +298,9 @@ func (s *Scaffold) ListApisixGlobalRules() ([]*v1.GlobalRule, error) {
return nil, err
}
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
return nil, err
Expand All @@ -318,8 +320,8 @@ func (s *Scaffold) ListApisixRoutes() ([]*v1.Route, error) {
return nil, err
}
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
Expand All @@ -340,8 +342,8 @@ func (s *Scaffold) ListApisixConsumers() ([]*v1.Consumer, error) {
return nil, err
}
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
Expand All @@ -362,8 +364,8 @@ func (s *Scaffold) ListApisixStreamRoutes() ([]*v1.StreamRoute, error) {
return nil, err
}
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
Expand All @@ -384,8 +386,8 @@ func (s *Scaffold) ListApisixSsl() ([]*v1.Ssl, error) {
return nil, err
}
err = cli.AddCluster(context.Background(), &apisix.ClusterOptions{
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
BaseURL: u.String(),
AdminKey: s.opts.APISIXAdminAPIKey,
MetricsCollector: metrics.NewPrometheusCollector(),
})
if err != nil {
Expand Down

0 comments on commit 60cd7b0

Please sign in to comment.