Skip to content

Commit 749c3f6

Browse files
Added Helm Test Category (#3254)
1 parent fb1baab commit 749c3f6

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

helm_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package main
2+
3+
import (
4+
"testing"
5+
6+
coreTests "github.com/jfrog/jfrog-cli-core/v2/utils/tests"
7+
"github.com/jfrog/jfrog-cli/utils/tests"
8+
)
9+
10+
var (
11+
helmCli *coreTests.JfrogCli
12+
)
13+
14+
func InitHelmTests() {
15+
initArtifactoryCli()
16+
initHelmCli()
17+
cleanUpOldBuilds()
18+
cleanUpOldRepositories()
19+
tests.AddTimestampToGlobalVars()
20+
createRequiredRepos()
21+
}
22+
23+
func CleanHelmTests() {
24+
deleteCreatedRepos()
25+
}
26+
27+
func initHelmCli() {
28+
if helmCli != nil {
29+
return
30+
}
31+
helmCli = coreTests.NewJfrogCli(execMain, "jfrog", authenticate(false))
32+
}
33+
34+
func initHelmTest(t *testing.T) {
35+
if !*tests.TestHelm {
36+
t.Skip("Skipping Helm test. To run Helm test add the '-test.helm=true' option.")
37+
}
38+
}
39+
40+
func TestHelmExample(t *testing.T) {
41+
initHelmTest(t)
42+
}

main_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ func setupIntegrationTests() {
8383
if *tests.TestEvidence {
8484
InitEvidenceTests()
8585
}
86+
if *tests.TestHelm {
87+
InitHelmTests()
88+
}
8689
}
8790

8891
func tearDownIntegrationTests() {
@@ -107,6 +110,9 @@ func tearDownIntegrationTests() {
107110
if *tests.TestEvidence {
108111
CleanEvidenceTests()
109112
}
113+
if *tests.TestHelm {
114+
CleanHelmTests()
115+
}
110116
}
111117

112118
func InitBuildToolsTests() {
@@ -190,7 +196,7 @@ func initArtifactoryCli() {
190196
*tests.JfrogUrl = utils.AddTrailingSlashIfNeeded(*tests.JfrogUrl)
191197
artifactoryCli = coreTests.NewJfrogCli(execMain, "jfrog rt", authenticate(false))
192198
if (*tests.TestArtifactory && !*tests.TestArtifactoryProxy) || *tests.TestPlugins || *tests.TestArtifactoryProject ||
193-
*tests.TestAccess || *tests.TestTransfer || *tests.TestLifecycle {
199+
*tests.TestAccess || *tests.TestTransfer || *tests.TestLifecycle || *tests.TestHelm {
194200
configCli = createConfigJfrogCLI(authenticate(true))
195201
platformCli = coreTests.NewJfrogCli(execMain, "jfrog", authenticate(false))
196202
}

utils/tests/utils.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ var (
7474
TestTransfer *bool
7575
TestLifecycle *bool
7676
TestEvidence *bool
77+
TestHelm *bool
7778
HideUnitTestLog *bool
7879
ciRunId *string
7980
InstallDataTransferPlugin *bool
@@ -111,6 +112,7 @@ func init() {
111112
TestTransfer = flag.Bool("test.transfer", false, "Test files transfer")
112113
TestLifecycle = flag.Bool("test.lifecycle", false, "Test lifecycle")
113114
TestEvidence = flag.Bool("test.evidence", false, "Test evidence")
115+
TestHelm = flag.Bool("test.helm", false, "Test Helm")
114116
ContainerRegistry = flag.String("test.containerRegistry", "localhost:8082", "Container registry")
115117
HideUnitTestLog = flag.Bool("test.hideUnitTestLog", false, "Hide unit tests logs and print it in a file")
116118
InstallDataTransferPlugin = flag.Bool("test.installDataTransferPlugin", false, "Install data-transfer plugin on the source Artifactory server")
@@ -348,6 +350,7 @@ func GetNonVirtualRepositories() map[*string]string {
348350
TestAccess: {&RtRepo1},
349351
TestTransfer: {&RtRepo1, &RtRepo2, &MvnRepo1, &MvnRemoteRepo, &DockerRemoteRepo},
350352
TestLifecycle: {&RtDevRepo, &RtProdRepo1, &RtProdRepo2},
353+
TestHelm: {&RtRepo1},
351354
}
352355
return getNeededRepositories(nonVirtualReposMap)
353356
}
@@ -371,6 +374,7 @@ func GetVirtualRepositories() map[*string]string {
371374
TestPlugins: {},
372375
TestXray: {&GoVirtualRepo},
373376
TestAccess: {},
377+
TestHelm: {},
374378
}
375379
return getNeededRepositories(virtualReposMap)
376380
}
@@ -409,6 +413,7 @@ func GetBuildNames() []string {
409413
TestAccess: {},
410414
TestTransfer: {&MvnBuildName},
411415
TestLifecycle: {&LcBuildName1, &LcBuildName2, &LcBuildName3},
416+
TestHelm: {},
412417
}
413418
return getNeededBuildNames(buildNamesMap)
414419
}

0 commit comments

Comments
 (0)