@@ -29,14 +29,16 @@ import (
29
29
)
30
30
31
31
const (
32
- artifactoryLifecycleMinVersion = "7.68.3"
33
- gpgKeyPairName = "lc-tests-key-pair"
34
- lcTestdataPath = "lifecycle"
35
- releaseBundlesSpec = "release-bundles-spec.json"
36
- buildsSpec12 = "builds-spec-1-2.json"
37
- buildsSpec3 = "builds-spec-3.json"
38
- prodEnvironment = "PROD"
39
- number1 , number2 , number3 = "111" , "222" , "333"
32
+ artifactoryLifecycleMinVersion = "7.68.3"
33
+ signingKeyOptionalArtifactoryMinVersion = "7.101.1"
34
+ gpgKeyPairName = "lc-tests-key-pair"
35
+ lcTestdataPath = "lifecycle"
36
+ releaseBundlesSpec = "release-bundles-spec.json"
37
+ buildsSpec12 = "builds-spec-1-2.json"
38
+ buildsSpec3 = "builds-spec-3.json"
39
+ prodEnvironment = "PROD"
40
+ number1 , number2 , number3 = "111" , "222" , "333"
41
+ withoutSigningKey = true
40
42
)
41
43
42
44
var (
45
47
)
46
48
47
49
func TestBackwardCompatibleReleaseBundleCreation (t * testing.T ) {
48
- cleanCallback := initLifecycleTest (t )
50
+ cleanCallback := initLifecycleTest (t , artifactoryLifecycleMinVersion )
49
51
defer cleanCallback ()
50
52
lcManager := getLcServiceManager (t )
51
53
@@ -87,30 +89,39 @@ func compareRbArtifacts(t *testing.T, actual services.ReleaseBundleSpecResponse,
87
89
}
88
90
89
91
func TestReleaseBundleCreationFromAql (t * testing.T ) {
90
- testReleaseBundleCreation (t , tests .UploadDevSpecA , tests .LifecycleAql , tests .GetExpectedLifecycleCreationByAql ())
92
+ testReleaseBundleCreation (t , tests .UploadDevSpecA , tests .LifecycleAql , tests .GetExpectedLifecycleCreationByAql (), false )
91
93
}
92
94
93
95
func TestReleaseBundleCreationFromArtifacts (t * testing.T ) {
94
- testReleaseBundleCreation (t , tests .UploadDevSpec , tests .LifecycleArtifacts , tests .GetExpectedLifecycleCreationByArtifacts ())
96
+ testReleaseBundleCreation (t , tests .UploadDevSpec , tests .LifecycleArtifacts , tests .GetExpectedLifecycleCreationByArtifacts (), false )
95
97
}
96
98
97
- func testReleaseBundleCreation (t * testing.T , uploadSpec , creationSpec string , expected []string ) {
98
- cleanCallback := initLifecycleTest (t )
99
- defer cleanCallback ()
100
- lcManager := getLcServiceManager (t )
99
+ func TestReleaseBundleCreationFromArtifactsWithoutSigningKey (t * testing.T ) {
100
+ testReleaseBundleCreation (t , tests .UploadDevSpec , tests .LifecycleArtifacts , tests .GetExpectedLifecycleCreationByArtifacts (), withoutSigningKey )
101
+ }
102
+
103
+ func testReleaseBundleCreation (t * testing.T , uploadSpec , creationSpec string , expected []string , withoutSigningKey bool ) {
104
+ if withoutSigningKey {
105
+ cleanCallback := initLifecycleTest (t , signingKeyOptionalArtifactoryMinVersion )
106
+ defer cleanCallback ()
107
+ } else {
108
+ cleanCallback := initLifecycleTest (t , artifactoryLifecycleMinVersion )
109
+ defer cleanCallback ()
110
+ }
101
111
112
+ lcManager := getLcServiceManager (t )
102
113
specFile , err := tests .CreateSpec (uploadSpec )
103
114
assert .NoError (t , err )
104
115
runRt (t , "upload" , "--spec=" + specFile )
105
116
106
- createRbFromSpec (t , creationSpec , tests .LcRbName1 , number1 , true )
117
+ createRbFromSpec (t , creationSpec , tests .LcRbName1 , number1 , true , withoutSigningKey )
107
118
defer deleteReleaseBundle (t , lcManager , tests .LcRbName1 , number1 )
108
119
109
120
assertRbArtifacts (t , lcManager , tests .LcRbName1 , number1 , expected )
110
121
}
111
122
112
123
func TestLifecycleFullFlow (t * testing.T ) {
113
- cleanCallback := initLifecycleTest (t )
124
+ cleanCallback := initLifecycleTest (t , signingKeyOptionalArtifactoryMinVersion )
114
125
defer cleanCallback ()
115
126
lcManager := getLcServiceManager (t )
116
127
@@ -119,17 +130,17 @@ func TestLifecycleFullFlow(t *testing.T) {
119
130
defer deleteBuilds ()
120
131
121
132
// Create release bundle from builds synchronously.
122
- createRbFromSpec (t , tests .LifecycleBuilds12 , tests .LcRbName1 , number1 , true )
133
+ createRbFromSpec (t , tests .LifecycleBuilds12 , tests .LcRbName1 , number1 , true , false )
123
134
defer deleteReleaseBundle (t , lcManager , tests .LcRbName1 , number1 )
124
135
125
136
// Create release bundle from a build asynchronously and assert status.
126
137
// This build has dependencies which are included in the release bundle.
127
- createRbFromSpec (t , tests .LifecycleBuilds3 , tests .LcRbName2 , number2 , false )
138
+ createRbFromSpec (t , tests .LifecycleBuilds3 , tests .LcRbName2 , number2 , false , false )
128
139
defer deleteReleaseBundle (t , lcManager , tests .LcRbName2 , number2 )
129
140
assertStatusCompleted (t , lcManager , tests .LcRbName2 , number2 , "" )
130
141
131
142
// Create a combined release bundle from the two previous release bundle.
132
- createRbFromSpec (t , tests .LifecycleReleaseBundles , tests .LcRbName3 , number3 , true )
143
+ createRbFromSpec (t , tests .LifecycleReleaseBundles , tests .LcRbName3 , number3 , true , false )
133
144
defer deleteReleaseBundle (t , lcManager , tests .LcRbName3 , number3 )
134
145
135
146
// Promote the last release bundle to prod repo 1.
@@ -161,7 +172,7 @@ func TestLifecycleFullFlow(t *testing.T) {
161
172
162
173
// Import bundles only work on onPerm platforms
163
174
func TestImportReleaseBundle (t * testing.T ) {
164
- cleanCallback := initLifecycleTest (t )
175
+ cleanCallback := initLifecycleTest (t , artifactoryLifecycleMinVersion )
165
176
defer cleanCallback ()
166
177
wd , err := os .Getwd ()
167
178
assert .NoError (t , err )
@@ -195,22 +206,25 @@ func uploadBuilds(t *testing.T) func() {
195
206
func createRbBackwardCompatible (t * testing.T , specName , sourceOption , rbName , rbVersion string , sync bool ) {
196
207
specFile , err := getSpecFile (specName )
197
208
assert .NoError (t , err )
198
- createRb (t , specFile , sourceOption , rbName , rbVersion , sync )
209
+ createRb (t , specFile , sourceOption , rbName , rbVersion , sync , false )
199
210
}
200
211
201
- func createRbFromSpec (t * testing.T , specName , rbName , rbVersion string , sync bool ) {
212
+ func createRbFromSpec (t * testing.T , specName , rbName , rbVersion string , sync bool , withoutSigningKey bool ) {
202
213
specFile , err := tests .CreateSpec (specName )
203
214
assert .NoError (t , err )
204
- createRb (t , specFile , "spec" , rbName , rbVersion , sync )
215
+ createRb (t , specFile , "spec" , rbName , rbVersion , sync , withoutSigningKey )
205
216
}
206
217
207
- func createRb (t * testing.T , specFilePath , sourceOption , rbName , rbVersion string , sync bool ) {
218
+ func createRb (t * testing.T , specFilePath , sourceOption , rbName , rbVersion string , sync bool , withoutSigningKey bool ) {
208
219
argsAndOptions := []string {
209
220
"rbc" ,
210
221
rbName ,
211
222
rbVersion ,
212
223
getOption (sourceOption , specFilePath ),
213
- getOption (cliutils .SigningKey , gpgKeyPairName ),
224
+ }
225
+
226
+ if ! withoutSigningKey {
227
+ argsAndOptions = append (argsAndOptions , getOption (cliutils .SigningKey , gpgKeyPairName ))
214
228
}
215
229
// Add the --sync option only if requested, to test the default value.
216
230
if sync {
@@ -363,11 +377,12 @@ func uploadBuildWithDeps(t *testing.T, buildName, buildNumber string) {
363
377
runRt (t , "build-publish" , buildName , buildNumber )
364
378
}
365
379
366
- func initLifecycleTest (t * testing.T ) (cleanCallback func ()) {
380
+ func initLifecycleTest (t * testing.T , minVersion string ) (cleanCallback func ()) {
367
381
if ! * tests .TestLifecycle {
368
382
t .Skip ("Skipping lifecycle test. To run release bundle test add the '-test.lc=true' option." )
369
383
}
370
- validateArtifactoryVersion (t , artifactoryLifecycleMinVersion )
384
+
385
+ validateArtifactoryVersion (t , minVersion )
371
386
372
387
if ! isLifecycleSupported (t ) {
373
388
t .Skip ("Skipping lifecycle test because the functionality is not enabled on the provided JPD." )
0 commit comments