Skip to content

Commit

Permalink
chore: change test library and fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarciaaco committed Mar 19, 2024
1 parent 0881808 commit 311be30
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
)

require github.com/onsi/ginkgo/v2 v2.15.0

require (
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
Expand Down Expand Up @@ -86,7 +84,6 @@ require (
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand All @@ -95,7 +92,6 @@ require (
github.com/google/go-containerregistry v0.16.1 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down
10 changes: 5 additions & 5 deletions pkg/controller/integration/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (

integration = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "camel_k_integration_phase",
Name: "camel_k_integration_phase_total",
Help: "Number of integration processed",
}, []string{
"phase",
Expand All @@ -57,12 +57,12 @@ func init() {
metrics.Registry.MustRegister(timeToFirstReadiness, integration)
}

func updateIntegrationPhase(iId string, p string) {
phase := strings.Replace(strings.ToLower(p), " ", "_", -1)
func updateIntegrationPhase(iID string, p string) {
phase := strings.ReplaceAll(strings.ToLower(p), " ", "_")

if phase != "" && iId != "" {
if phase != "" && iID != "" {
labels := prometheus.Labels{
"id": iId,
"id": iID,
"phase": phase,
}
integration.With(labels).Inc()
Expand Down
7 changes: 2 additions & 5 deletions pkg/controller/integration/metrics_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package integration

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/prometheus/client_golang/prometheus"
dto "github.com/prometheus/client_model/go"
"github.com/stretchr/testify/assert"
"testing"
)

Expand Down Expand Up @@ -38,8 +37,6 @@ func collect(col prometheus.Collector, do func(*dto.Metric)) {
}

func Test_updateIntegrationPhase(t *testing.T) {
RegisterFailHandler(Fail)

type args struct {
iId string
p string
Expand Down Expand Up @@ -78,7 +75,7 @@ func Test_updateIntegrationPhase(t *testing.T) {
labels := map[string]string{"phase": tt.args.p, "id": tt.args.iId}
if i, err := integration.GetMetricWith(labels); err == nil {
val := getMetricValue(i)
Expect(val).To(Equal(tt.args.expected))
assert.Equal(t, val, tt.args.expected)
}
})
}
Expand Down

0 comments on commit 311be30

Please sign in to comment.