diff --git a/pkg/metrics/metrics_test.go b/pkg/metrics/metrics_test.go index 8ffbbf69..be204cd4 100644 --- a/pkg/metrics/metrics_test.go +++ b/pkg/metrics/metrics_test.go @@ -39,4 +39,31 @@ func TestMetricsInitialization(t *testing.T) { assert.NotNil(t, cpm.kubeAPIRequestsTotal) assert.NotNil(t, cpm.kubeAPIRequestsErrorsTotal) }) + + t.Run("NewApplicationsMetrics", func(t *testing.T) { + apm := NewApplicationsMetrics() + assert.NotNil(t, apm) + assert.NotNil(t, apm.applicationsTotal) + assert.NotNil(t, apm.imagesWatchedTotal) + assert.NotNil(t, apm.imagesUpdatedTotal) + assert.NotNil(t, apm.imagesUpdatedErrorsTotal) + }) +} + +func TestMetricsOperations(t *testing.T) { + epm := Endpoint() + epm.IncreaseRequest("/registry1", false) + epm.IncreaseRequest("/registry1", true) + + cpm := Clients() + cpm.IncreaseArgoCDClientRequest("server1", 1) + cpm.IncreaseArgoCDClientError("server1", 2) + cpm.IncreaseK8sClientRequest(3) + cpm.IncreaseK8sClientError(4) + + apm := Applications() + apm.IncreaseImageUpdate("app1", 1) + apm.IncreaseUpdateErrors("app1", 2) + apm.SetNumberOfApplications(3) + apm.SetNumberOfImagesWatched("app1", 4) } diff --git a/pkg/options/options_test.go b/pkg/options/options_test.go index a89fc1b9..8f1efddc 100644 --- a/pkg/options/options_test.go +++ b/pkg/options/options_test.go @@ -72,3 +72,11 @@ func Test_Platforms(t *testing.T) { assert.Equal(t, ps[1], PlatformKey("linux", "arm", "v8")) }) } + +func Test_WithLogger(t *testing.T) { + opts := NewManifestOptions() + logger := opts.Logger() + assert.NotNil(t, logger) + opts = opts.WithLogger(logger) + assert.Equal(t, logger, opts.Logger()) +}