As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit c636a23b authored by Igor Drozdov's avatar Igor Drozdov Committed by GitLab
Browse files

Merge branch 'spatnaik/fix_lint_issues_in_testhelper' into 'main'

chore: Fixed lint issues in internal/testhelper/testhelper.go

See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/978



Merged-by: default avatarIgor Drozdov <idrozdov@gitlab.com>
Approved-by: default avatarAlejandro Rodríguez <alejandro@gitlab.com>
Approved-by: default avatarIgor Drozdov <idrozdov@gitlab.com>
Co-authored-by: default avatarShekhar Patnaik <spatnaik@gitlab.com>
parents 46dabc79 adf6cd64
No related branches found
No related tags found
No related merge requests found
// Package testhelper consists of various helper functions to setup the test environment.
package testhelper
import (
Loading
Loading
@@ -11,12 +12,14 @@ import (
"github.com/stretchr/testify/require"
)
// TempEnv sets environment variables for the test
func TempEnv(t *testing.T, env map[string]string) {
for key, value := range env {
t.Setenv(key, value)
}
}
// PrepareTestRootDir prepares the test root directory with the test data
func PrepareTestRootDir(t *testing.T) string {
t.Helper()
Loading
Loading
@@ -28,7 +31,10 @@ func PrepareTestRootDir(t *testing.T) string {
oldWd, err := os.Getwd()
require.NoError(t, err)
t.Cleanup(func() { os.Chdir(oldWd) })
t.Cleanup(func() {
err = os.Chdir(oldWd)
require.NoError(t, err)
})
require.NoError(t, os.Chdir(testRoot))
Loading
Loading
@@ -49,7 +55,7 @@ func copyTestData(testRoot string) error {
func getTestDataDir() (string, error) {
_, currentFile, _, ok := runtime.Caller(0)
if !ok {
return "", fmt.Errorf("Could not get caller info")
return "", fmt.Errorf("could not get caller info")
}
return path.Join(path.Dir(currentFile), "testdata"), nil
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment