Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions helm_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package main

import (
"testing"

coreTests "github.com/jfrog/jfrog-cli-core/v2/utils/tests"
"github.com/jfrog/jfrog-cli/utils/tests"
)

var (
helmCli *coreTests.JfrogCli
)

func InitHelmTests() {
initArtifactoryCli()
initHelmCli()
cleanUpOldBuilds()
cleanUpOldRepositories()
tests.AddTimestampToGlobalVars()
createRequiredRepos()
}

func CleanHelmTests() {
deleteCreatedRepos()
}

func initHelmCli() {
if helmCli != nil {
return
}
helmCli = coreTests.NewJfrogCli(execMain, "jfrog", authenticate(false))
}

func initHelmTest(t *testing.T) {
if !*tests.TestHelm {
t.Skip("Skipping Helm test. To run Helm test add the '-test.helm=true' option.")
}
}

func TestHelmExample(t *testing.T) {
initHelmTest(t)
}
8 changes: 7 additions & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func setupIntegrationTests() {
if *tests.TestEvidence {
InitEvidenceTests()
}
if *tests.TestHelm {
InitHelmTests()
}
}

func tearDownIntegrationTests() {
Expand All @@ -107,6 +110,9 @@ func tearDownIntegrationTests() {
if *tests.TestEvidence {
CleanEvidenceTests()
}
if *tests.TestHelm {
CleanHelmTests()
}
}

func InitBuildToolsTests() {
Expand Down Expand Up @@ -190,7 +196,7 @@ func initArtifactoryCli() {
*tests.JfrogUrl = utils.AddTrailingSlashIfNeeded(*tests.JfrogUrl)
artifactoryCli = coreTests.NewJfrogCli(execMain, "jfrog rt", authenticate(false))
if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestPlugins || *tests.TestArtifactoryProject ||
*tests.TestAccess || *tests.TestTransfer || *tests.TestLifecycle {
*tests.TestAccess || *tests.TestTransfer || *tests.TestLifecycle || *tests.TestHelm {
configCli = createConfigJfrogCLI(authenticate(true))
platformCli = coreTests.NewJfrogCli(execMain, "jfrog", authenticate(false))
}
Expand Down
5 changes: 5 additions & 0 deletions utils/tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ var (
TestTransfer *bool
TestLifecycle *bool
TestEvidence *bool
TestHelm *bool
HideUnitTestLog *bool
ciRunId *string
InstallDataTransferPlugin *bool
Expand Down Expand Up @@ -111,6 +112,7 @@ func init() {
TestTransfer = flag.Bool("test.transfer", false, "Test files transfer")
TestLifecycle = flag.Bool("test.lifecycle", false, "Test lifecycle")
TestEvidence = flag.Bool("test.evidence", false, "Test evidence")
TestHelm = flag.Bool("test.helm", false, "Test Helm")
ContainerRegistry = flag.String("test.containerRegistry", "localhost:8082", "Container registry")
HideUnitTestLog = flag.Bool("test.hideUnitTestLog", false, "Hide unit tests logs and print it in a file")
InstallDataTransferPlugin = flag.Bool("test.installDataTransferPlugin", false, "Install data-transfer plugin on the source Artifactory server")
Expand Down Expand Up @@ -348,6 +350,7 @@ func GetNonVirtualRepositories() map[*string]string {
TestAccess: {&RtRepo1},
TestTransfer: {&RtRepo1, &RtRepo2, &MvnRepo1, &MvnRemoteRepo, &DockerRemoteRepo},
TestLifecycle: {&RtDevRepo, &RtProdRepo1, &RtProdRepo2},
TestHelm: {&RtRepo1},
}
return getNeededRepositories(nonVirtualReposMap)
}
Expand All @@ -371,6 +374,7 @@ func GetVirtualRepositories() map[*string]string {
TestPlugins: {},
TestXray: {&GoVirtualRepo},
TestAccess: {},
TestHelm: {},
}
return getNeededRepositories(virtualReposMap)
}
Expand Down Expand Up @@ -409,6 +413,7 @@ func GetBuildNames() []string {
TestAccess: {},
TestTransfer: {&MvnBuildName},
TestLifecycle: {&LcBuildName1, &LcBuildName2, &LcBuildName3},
TestHelm: {},
}
return getNeededBuildNames(buildNamesMap)
}
Expand Down
Loading