Skip to content

Commit

Permalink
Fix golangci-lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Krithik Vaidya <[email protected]>
  • Loading branch information
krithikvaidya committed Sep 9, 2021
1 parent d6a2052 commit dddbc03
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions mesheryctl/pkg/utils/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
)

func init() {

// Get current directory
_, filename, _, ok := runtime.Caller(0)
if !ok {
Expand All @@ -35,7 +34,6 @@ func init() {
if err != nil {
log.Fatal("Failed to create test directory")
}

}

func TestChangePlatform(t *testing.T) {
Expand Down Expand Up @@ -75,7 +73,6 @@ func TestChangePlatform(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

err := mctlCfg.SetCurrentContext(tt.args.contextName)
if err != nil {
if (err != nil) != tt.wantErr {
Expand Down Expand Up @@ -122,13 +119,11 @@ func TestChangePlatform(t *testing.T) {
if err := Populate(currDir+"/fixtures/platform/original/TestConfig.yaml", fixture); err != nil {
t.Fatal(err, "Could not complete test. Unable to repopulate fixture")
}

})
}
}

func TestChangeConfigEndpoint(t *testing.T) {

// Setup path to test config file
currDir := GetBasePath(t)
testConfigPath := currDir + "/fixtures/platform/TestChangeEndpointConfig.yaml"
Expand Down Expand Up @@ -162,7 +157,6 @@ func TestChangeConfigEndpoint(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

err := mctlCfg.SetCurrentContext(tt.ctxName)
if err != nil {
t.Fatal("error setting context", err)
Expand Down Expand Up @@ -204,7 +198,6 @@ func TestChangeConfigEndpoint(t *testing.T) {
if err := Populate(currDir+"/fixtures/platform/original/TestChangeEndpointConfig.yaml", testConfigPath); err != nil {
t.Fatal(err, "Could not complete test. Unable to repopulate fixture")
}

})
}
}
Expand Down Expand Up @@ -243,7 +236,6 @@ func TestGetManifestURL(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

// Read fixture
file, _ := ioutil.ReadFile("fixtures/platform/" + tt.fixture)
manifest := Manifest{}
Expand All @@ -264,13 +256,11 @@ func TestGetManifestURL(t *testing.T) {
if got != want {
t.Fatalf("GetManifestURL() = %v, want %v", got, want)
}

})
}
}

func TestGetPods(t *testing.T) {

tests := []struct {
name string
namespace string
Expand All @@ -285,7 +275,6 @@ func TestGetPods(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

// create an kubernetes client
client, err := meshkitkube.New([]byte(""))

Expand All @@ -309,7 +298,6 @@ func TestGetPods(t *testing.T) {
if got == nil {
t.Fatalf("GetPods() error: got nil PodList")
}

})
}
}
Expand Down Expand Up @@ -351,7 +339,6 @@ func TestIsPodRequired(t *testing.T) {
}

func TestDownloadManifests(t *testing.T) {

// initialize mock server for handling requests
StartMockery(t)

Expand Down Expand Up @@ -385,7 +372,6 @@ func TestDownloadManifests(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

httpmock.RegisterResponder("GET", tt.url, httpmock.NewStringResponder(200, apiResponse))

manifests := []Manifest{tt.manifest}
Expand Down Expand Up @@ -419,7 +405,6 @@ func TestDownloadManifests(t *testing.T) {
if err != nil {
t.Fatalf("Could not delete manifest from test folder")
}

})
}

Expand All @@ -428,7 +413,6 @@ func TestDownloadManifests(t *testing.T) {
}

func TestDownloadOperatorManifest(t *testing.T) {

// initialize mock server for handling requests
StartMockery(t)

Expand Down Expand Up @@ -466,7 +450,6 @@ func TestDownloadOperatorManifest(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

for _, url := range tt.urls {
httpmock.RegisterResponder("GET", url, httpmock.NewStringResponder(200, apiResponse))
}
Expand All @@ -478,7 +461,6 @@ func TestDownloadOperatorManifest(t *testing.T) {
actualFileContents := make([]string, len(tt.filenames))

for i, filename := range tt.filenames {

// Actual file contents
actualContent, err := ioutil.ReadFile(filepath.Join(MesheryFolder, ManifestsFolder, filename))
if err != nil {
Expand All @@ -487,14 +469,12 @@ func TestDownloadOperatorManifest(t *testing.T) {

actualFileContent := string(actualContent)
actualFileContents[i] = actualFileContent

}

// Expected file contents
testdataDir := currDir + "/testdata/platform/downloadoperatormanifest"

for i, golden := range tt.goldens {

golden := NewGoldenFile(t, golden, testdataDir)
if *update {
golden.Write(actualFileContents[i])
Expand All @@ -509,9 +489,7 @@ func TestDownloadOperatorManifest(t *testing.T) {
if err != nil {
t.Errorf("Could not delete operator manifest [%v] from test folder", tt.filenames[i])
}

}

})
}

Expand Down

0 comments on commit dddbc03

Please sign in to comment.