From b4f24aa4e554c2e41c6e4b751e7c727987747f88 Mon Sep 17 00:00:00 2001 From: alvarocabanas Date: Mon, 21 Aug 2023 17:11:13 +0200 Subject: [PATCH] Remove not needed tests --- pkg/ctl/sender/client_containerd_test.go | 41 --------------------- pkg/ctl/sender/client_docker_test.go | 45 ------------------------ 2 files changed, 86 deletions(-) delete mode 100644 pkg/ctl/sender/client_containerd_test.go delete mode 100644 pkg/ctl/sender/client_docker_test.go diff --git a/pkg/ctl/sender/client_containerd_test.go b/pkg/ctl/sender/client_containerd_test.go deleted file mode 100644 index 67ff7d972..000000000 --- a/pkg/ctl/sender/client_containerd_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020 New Relic Corporation. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 -//go:build linux || darwin - -package sender - -import ( - "testing" - - "github.com/newrelic/infrastructure-agent/pkg/helpers" -) - -func TestContainerdClient(t *testing.T) { - type args struct { - containerID string - namespace string - } - tests := []struct { - name string - args args - wantC bool - wantErr bool - }{ - {"no container id fails", args{containerID: "", namespace: ""}, false, true}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if !helpers.IsDockerRunning() { - t.Skip("docker required for this test suite") - } - gotC, err := NewContainerdClient(tt.args.containerID, tt.args.namespace) - if (err != nil) != tt.wantErr { - t.Errorf("NewDockerClient() error = %v, want %v", err, tt.wantErr) - return - } - if (gotC != nil) != tt.wantC { - t.Errorf("NewDockerClient() client = %v, want %v", gotC, tt.wantC) - } - }) - } -} diff --git a/pkg/ctl/sender/client_docker_test.go b/pkg/ctl/sender/client_docker_test.go deleted file mode 100644 index 08f782b1f..000000000 --- a/pkg/ctl/sender/client_docker_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 New Relic Corporation. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 -package sender - -import ( - "runtime" - "testing" - - "github.com/newrelic/infrastructure-agent/pkg/helpers" -) - -func TestNewDockerClient(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skip("skipping flaky test on windows") - } - - type args struct { - apiVersion string - containerID string - } - tests := []struct { - name string - args args - wantC bool - wantErr bool - }{ - {"no container id fails", args{apiVersion: "", containerID: ""}, false, true}, - {"no api version does not fail", args{apiVersion: "", containerID: "123"}, true, false}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if !helpers.IsDockerRunning() { - t.Skip("docker required for this test suite") - } - gotC, err := NewDockerClient(tt.args.apiVersion, tt.args.containerID) - if (err != nil) != tt.wantErr { - t.Errorf("NewDockerClient() error = %v, want %v", err, tt.wantErr) - return - } - if (gotC != nil) != tt.wantC { - t.Errorf("NewDockerClient() client = %v, want %v", gotC, tt.wantC) - } - }) - } -}