@@ -142,7 +142,7 @@ func InitNativeDockerTest(t *testing.T) (mockCli *coreTests.JfrogCli, cleanUp fu
142142 if ! * configTests .TestDockerScan {
143143 t .Skip (getSkipTestMsg ("Docker scan command integration (Ubuntu)" , "--test.dockerScan" ))
144144 }
145- return InitTestWithMockCommandOrParams (t , cli .DockerScanMockCommand )
145+ return InitTestWithMockCommandOrParams (t , false , cli .DockerScanMockCommand )
146146}
147147
148148func InitCurationTest (t * testing.T ) {
@@ -183,19 +183,25 @@ func CreateJfrogHomeConfig(t *testing.T, encryptPassword bool) {
183183func InitTestCliDetails (testApplication components.App ) {
184184 configTests .TestApplication = & testApplication
185185 if configTests .PlatformCli == nil {
186- configTests .PlatformCli = GetTestCli (testApplication )
186+ configTests .PlatformCli = GetTestCli (testApplication , false )
187187 }
188188}
189189
190- func GetTestCli (testApplication components.App ) (testCli * coreTests.JfrogCli ) {
191- creds := authenticateXray ()
190+ func GetTestCli (testApplication components.App , xrayUrlOnly bool ) (testCli * coreTests.JfrogCli ) {
191+ creds := authenticateXray (xrayUrlOnly )
192192 return coreTests .NewJfrogCli (func () error { return plugins .RunCliWithPlugin (testApplication )() }, "" , creds )
193193}
194194
195- func authenticateXray () string {
195+ func authenticateXray (xrayUrlOnly bool ) string {
196196 * configTests .JfrogUrl = clientUtils .AddTrailingSlashIfNeeded (* configTests .JfrogUrl )
197- configTests .XrDetails = & config.ServerDetails {Url : * configTests .JfrogUrl , ArtifactoryUrl : * configTests .JfrogUrl + configTests .ArtifactoryEndpoint , XrayUrl : * configTests .JfrogUrl + configTests .XrayEndpoint }
198- cred := fmt .Sprintf ("--url=%s" , configTests .XrDetails .XrayUrl )
197+ var cred string
198+ if xrayUrlOnly {
199+ configTests .XrDetails = & config.ServerDetails {XrayUrl : * configTests .JfrogUrl + configTests .XrayEndpoint }
200+ cred = fmt .Sprintf ("--xray-url=%s" , configTests .XrDetails .XrayUrl )
201+ } else {
202+ configTests .XrDetails = & config.ServerDetails {Url : * configTests .JfrogUrl , ArtifactoryUrl : * configTests .JfrogUrl + configTests .ArtifactoryEndpoint , XrayUrl : * configTests .JfrogUrl + configTests .XrayEndpoint }
203+ cred = fmt .Sprintf ("--url=%s" , configTests .XrDetails .XrayUrl )
204+ }
199205 if * configTests .JfrogAccessToken != "" {
200206 configTests .XrDetails .AccessToken = * configTests .JfrogAccessToken
201207 cred += fmt .Sprintf (" --access-token=%s" , configTests .XrDetails .AccessToken )
@@ -391,7 +397,7 @@ func CreateRepos(repos map[*string]string) {
391397 }
392398}
393399
394- func InitTestWithMockCommandOrParams (t * testing.T , mockCommands ... func () components.Command ) (mockCli * coreTests.JfrogCli , cleanUp func ()) {
400+ func InitTestWithMockCommandOrParams (t * testing.T , xrayUrlCli bool , mockCommands ... func () components.Command ) (mockCli * coreTests.JfrogCli , cleanUp func ()) {
395401 oldHomeDir := os .Getenv (coreutils .HomeDir )
396402 // Create server config to use with the command.
397403 CreateJfrogHomeConfig (t , true )
@@ -400,7 +406,7 @@ func InitTestWithMockCommandOrParams(t *testing.T, mockCommands ...func() compon
400406 for _ , mockCommand := range mockCommands {
401407 commands = append (commands , mockCommand ())
402408 }
403- return GetTestCli (components .CreateEmbeddedApp ("security" , commands )), func () {
409+ return GetTestCli (components .CreateEmbeddedApp ("security" , commands ), xrayUrlCli ), func () {
404410 clientTests .SetEnvAndAssert (t , coreutils .HomeDir , oldHomeDir )
405411 }
406412}
0 commit comments