@@ -7,14 +7,16 @@ def create_job(config, runtime_config)
7
7
config = {
8
8
"project_name" => "labors" ,
9
9
"secrets" => {
10
- "sftp_host" => "some-sftp-host" ,
11
- "sftp_user" => "user" ,
12
- "sftp_password" => "password" ,
13
- "sftp_port" => "22"
10
+ "sftp_ingest_host" => "some-sftp-host" ,
11
+ "sftp_ingest_user" => "user" ,
12
+ "sftp_ingest_password" => "password" ,
13
+ "sftp_deposit_host" => "other-sftp-host" ,
14
+ "sftp_deposit_user" => "user" ,
15
+ "sftp_deposit_password" => "password"
14
16
} ,
15
17
"config" => {
16
- "file_regex " => "LABORS(-|_).* " ,
17
- "sftp_root_dir " => "SSD" ,
18
+ "magic_string " => "LABORS" ,
19
+ "ingest_root_path " => "SSD" ,
18
20
"path_to_write_files" => "/tmp/" ,
19
21
"bucket_name" => "deposit" ,
20
22
"metis_root_path" => "files/some-sftp-host" ,
@@ -49,24 +51,16 @@ def create_job(config, runtime_config)
49
51
run_id : run_id ,
50
52
config_id : config [ "config_id" ] ,
51
53
version_number : config [ "version_number" ] ,
52
- state : { files_to_update_path : "/tmp/#{ run_id } /#{ SftpFileDiscoveryJob ::SFTP_FILES_TO_UPDATE_CSV } " } ,
54
+ state : {
55
+ files_to_update : sftp_files
56
+ } ,
53
57
orchestrator_metadata : { } ,
54
58
output : nil ,
55
59
created_at : Time . now ,
56
60
updated_at : Time . now
57
61
}
58
62
}
59
63
60
- def create_files_to_update_csv
61
- FileUtils . mkdir_p ( "/tmp/#{ run_id } " )
62
- CSV . open ( run_record [ :state ] [ :files_to_update_path ] , "wb" ) do |csv |
63
- csv << [ "path" , "modified_time" ]
64
- sftp_files . each do |file |
65
- csv << [ file [ :path ] , file [ :modified_time ] ]
66
- end
67
- end
68
- end
69
-
70
64
before do
71
65
ENV [ 'TOKEN' ] = TEST_TOKEN
72
66
ENV [ 'KUBE_ID' ] = run_id
@@ -78,7 +72,6 @@ def create_files_to_update_csv
78
72
let ( :captured_requests ) { [ ] }
79
73
80
74
before do
81
- create_files_to_update_csv
82
75
stub_initial_sftp_connection
83
76
stub_initial_ssh_connection
84
77
stub_polyphemus_get_run ( config [ "project_name" ] , run_id , run_record )
@@ -100,15 +93,16 @@ def create_files_to_update_csv
100
93
end
101
94
102
95
it 'fails to upload files' do
96
+ allow ( Polyphemus . instance . logger ) . to receive ( :warn )
97
+ expect ( Polyphemus . instance . logger ) . to receive ( :warn ) . with ( /Failed to upload to deposit host other-sftp-host/ )
98
+ expect ( Polyphemus . instance . logger ) . to receive ( :warn ) . with ( /Found 1 failed files/ )
99
+ expect ( Polyphemus . instance . logger ) . to receive ( :warn ) . with ( /SSD.*LABORS_S1.fastq.gz/ )
103
100
stub_remote_ssh_file_upload ( success : false )
104
101
105
102
job = create_job ( config , runtime_config )
106
103
context = job . execute
107
104
108
- failed_files_path = "/tmp/1234567890/#{ SftpDepositUploaderJob ::DEPOSIT_FAILED_FILES_CSV } "
109
- expect ( File . exist? ( failed_files_path ) ) . to be_truthy
110
105
expect ( captured_requests [ 0 ] [ :state ] [ :deposit_num_failed_files ] ) . to eq ( 1 )
111
- expect ( captured_requests [ 0 ] [ :state ] [ :deposit_failed_files_path ] ) . to eq ( failed_files_path )
112
106
end
113
107
114
108
end
0 commit comments