You've already forked sap-jenkins-library
							
							
				mirror of
				https://github.com/SAP/jenkins-library.git
				synced 2025-10-30 23:57:50 +02:00 
			
		
		
		
	kanikoExecute: fix unit-tests (#4188)
* Fix tests * Test * Fix * Test * Test * Clean up * Refactor
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							029957f98a
						
					
				
				
					commit
					d1f3e2fc53
				
			| @@ -507,14 +507,17 @@ func TestRunKanikoExecute(t *testing.T) { | ||||
| 			{"--dockerfile", "Dockerfile", "--context", cwd, "--destination", "my.registry.com:50000/myImage:myTag"}, | ||||
| 			{"--dockerfile", filepath.Join("sub1", "Dockerfile"), "--context", cwd, "--destination", "my.registry.com:50000/myImage-sub1:myTag"}, | ||||
| 			{"--dockerfile", filepath.Join("sub2", "Dockerfile"), "--context", cwd, "--destination", "my.registry.com:50000/myImage-sub2:myTag"}, | ||||
| 			{"packages", "registry:my.registry.com:50000/myImage:myTag", "-o", "cyclonedx-xml", "--file", "bom-docker-0.xml", "-q"}, | ||||
| 			{"packages", "registry:my.registry.com:50000/myImage-sub1:myTag", "-o", "cyclonedx-xml", "--file", "bom-docker-1.xml", "-q"}, | ||||
| 			{"packages", "registry:my.registry.com:50000/myImage-sub2:myTag", "-o", "cyclonedx-xml", "--file", "bom-docker-2.xml", "-q"}, | ||||
| 			{"packages", "registry:my.registry.com:50000/myImage:myTag", "-o", "cyclonedx-xml", "--file"}, | ||||
| 			{"packages", "registry:my.registry.com:50000/myImage-sub1:myTag", "-o", "cyclonedx-xml", "--file"}, | ||||
| 			{"packages", "registry:my.registry.com:50000/myImage-sub2:myTag", "-o", "cyclonedx-xml", "--file"}, | ||||
| 		} | ||||
| 		// need to go this way since we cannot count on the correct order | ||||
| 		for _, call := range execRunner.Calls { | ||||
| 		for index, call := range execRunner.Calls { | ||||
| 			found := false | ||||
| 			for _, expected := range expectedParams { | ||||
| 				if expected[0] == "packages" { | ||||
| 					expected = append(expected, fmt.Sprintf("bom-docker-%d.xml", index-3), "-q") | ||||
| 				} | ||||
| 				if strings.Join(call.Params, " ") == strings.Join(expected, " ") { | ||||
| 					found = true | ||||
| 					break | ||||
|   | ||||
		Reference in New Issue
	
	Block a user