Skip to content

Commit

Permalink
continue
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Sep 29, 2024
1 parent a89e5c2 commit 13337b0
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ jobs:
gradle-version: 7.6
# Test
- name: Run tests
run: go test -v github.com/jfrog/jfrog-cli-security --race --timeout 30m -cover ${{ matrix.os == 'ubuntu' && matrix.suite.ubuntuTestFlags || matrix.suite.testFlags }} --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }} --ci.runId=${{ runner.os }}-cli-test
run: go test -v github.com/jfrog/jfrog-cli-security --race --timeout 30m -cover ${{ matrix.os == 'ubuntu' && matrix.suite.ubuntuTestFlags || matrix.suite.testFlags }} --jfrog.url=${{ secrets.PLATFORM_URL }} --jfrog.adminToken=${{ secrets.PLATFORM_ADMIN_TOKEN }} --test.containerRegistry=${{ secrets.CONTAINER_REGISTRY }} --ci.runId=${{ runner.os }}-sec-test
32 changes: 31 additions & 1 deletion commands/curation/curationaudit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"github.com/stretchr/testify/require"
)

var TestDataDir = filepath.Join("..", "..", "tests", "testdata")
var TestDataDir = filepath.FromSlash(filepath.Join("..", "..", "tests", "testdata"))

func TestExtractPoliciesFromMsg(t *testing.T) {
var err error
Expand Down Expand Up @@ -419,6 +419,8 @@ func TestDoCurationAudit(t *testing.T) {
assert.NoError(t, err)
callback := clienttestutils.SetEnvWithCallbackAndAssert(t, coreutils.HomeDir, filepath.Join(currentDir, configurationDir))
defer callback()


callbackCurationFlag := clienttestutils.SetEnvWithCallbackAndAssert(t, utils.CurationSupportFlag, "true")
defer callbackCurationFlag()
// Golang option to disable the use of the checksum database
Expand Down Expand Up @@ -505,6 +507,34 @@ func TestDoCurationAudit(t *testing.T) {
}
}

func initCurationTest(t *testing.T) func() {
configurationDir, cleanUp := securityTestUtils.CreateTestProjectEnvAndChdir(t, tt.pathToTest)

Check failure on line 511 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: tt
defer cleanUp()

// setCurationFlagsForTest

configFilePath := WriteServerDetailsConfigFileBytes(t, config.ArtifactoryUrl, configurationDir, tt.createServerWithoutCreds)

Check failure on line 516 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: config.ArtifactoryUrl

Check failure on line 516 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: tt
defer func() {
assert.NoError(t, fileutils.RemoveTempDir(configFilePath))
}()
rootDir, err := os.Getwd()

Check failure on line 520 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

declared and not used: rootDir
assert.NoError(t, err)
}

Check failure on line 522 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

missing return

func setCurationFlagsForTest(t *testing.T) func() {
currentDir, err := os.Getwd()
assert.NoError(t, err)
callback := clienttestutils.SetEnvWithCallbackAndAssert(t, coreutils.HomeDir, filepath.Join(currentDir, configurationDir))

Check failure on line 527 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

undefined: configurationDir
defer callback()


callbackCurationFlag := clienttestutils.SetEnvWithCallbackAndAssert(t, utils.CurationSupportFlag, "true")
defer callbackCurationFlag()
// Golang option to disable the use of the checksum database
callbackNoSum := clienttestutils.SetEnvWithCallbackAndAssert(t, "GOSUMDB", "off")
defer callbackNoSum()
}

Check failure on line 536 in commands/curation/curationaudit_test.go

View workflow job for this annotation

GitHub Actions / Go-Sec

missing return

type testCase struct {
name string
pathToTest string
Expand Down
2 changes: 2 additions & 0 deletions jas/runner/jasrunner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ func TestJasRunner_AnalyzerManagerNotExist(t *testing.T) {
}

func TestJasRunner(t *testing.T) {
assert.NoError(t, jas.DownloadAnalyzerManagerIfNeeded(0))

securityParallelRunnerForTest := utils.CreateSecurityParallelRunner(cliutils.Threads)
scanResults := &utils.Results{ScaResults: []*utils.ScaScanResult{{Technology: techutils.Pip, XrayResults: jas.FakeBasicXrayResults}}, ExtendedScanResults: &utils.ExtendedScanResults{}}

Expand Down
5 changes: 3 additions & 2 deletions tests/utils/integration/test_integrationutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"path/filepath"
"testing"

Expand Down Expand Up @@ -114,9 +115,9 @@ func InitGitTest(t *testing.T) {
if !*configTests.TestGit {
t.Skip(getSkipTestMsg("Git commands integration", "--test.git"))
}
err := configTests.PlatformCli.WithoutCredentials().Exec("git", "version")
err := exec.Command("npm", "install").Run()
if err != nil {
t.Skip(fmt.Sprintf("Skipping Git commands integration tests. Git is not installed. %s", err.Error()))
t.Skipf("Skipping Git commands integration tests. Git is not installed. %s", err.Error())
}
}

Expand Down

0 comments on commit 13337b0

Please sign in to comment.