Skip to content
Merged
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
45 changes: 28 additions & 17 deletions lib/engines/hcktest/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,27 +629,38 @@ def handle_test_running
end
end

def create_project_package
package_playlist = @playlist.playlist if @project.options.test.package_with_playlist
sig { params(type: String, path: T.nilable(String)).returns(T.nilable(String)) }
def upload_package_asset(type, path)
return nil unless path

driver_path = @project.options.test.driver_path
supplemental_path = @project.options.test.supplemental_path
package_with_driver = @project.options.test.package_with_driver
unless File.exist?(path)
@logger.warn("#{type} path '#{path}' specified, but does not exist, skipping including")
return nil
end

remote_driver_path = nil
remote_supplemental_path = nil
remote_path = "#{STUDIO_PACKAGE_ASSETS_PATH}\\#{type}"
@logger.info("Uploading #{type.downcase} from '#{path}' to '#{remote_path}'")
@tools.upload_to_studio(path, remote_path)
remote_path
end

if package_with_driver && driver_path && File.exist?(driver_path)
remote_driver_path = "#{STUDIO_PACKAGE_ASSETS_PATH}\\Driver"
@logger.info("Uploading driver from '#{driver_path}' to '#{remote_driver_path}'")
@tools.upload_to_studio(driver_path, remote_driver_path)
end
sig { returns(T.nilable(String)) }
def prepare_package_driver_content
return unless @project.options.test.package_with_driver

if supplemental_path && File.exist?(supplemental_path)
remote_supplemental_path = "#{STUDIO_PACKAGE_ASSETS_PATH}\\Supplemental"
@logger.info("Uploading supplemental from '#{supplemental_path}' to '#{remote_supplemental_path}'")
@tools.upload_to_studio(supplemental_path, remote_supplemental_path)
end
upload_package_asset('Driver', @project.options.test.driver_path)
end

sig { returns(T.nilable(String)) }
def prepare_package_supplemental_content
upload_package_asset('Supplemental', @project.options.test.supplemental_path)
end

def create_project_package
package_playlist = @playlist.playlist if @project.options.test.package_with_playlist

remote_driver_path = prepare_package_driver_content
remote_supplemental_path = prepare_package_supplemental_content

res = @tools.create_project_package(@tag, package_playlist, nil, remote_driver_path, remote_supplemental_path)
@logger.info('Results package successfully created')
Expand Down
Loading