Skip to content

Commit f1eb6aa

Browse files
committed
update cache_files_list to list file only for specific test_suit_id
1 parent 868b6d9 commit f1eb6aa

File tree

1 file changed

+7
-1
lines changed
  • lib/rspec_tracer/remote_cache

1 file changed

+7
-1
lines changed

lib/rspec_tracer/remote_cache/aws.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class AwsError < StandardError; end
88
def initialize
99
@s3_bucket, @s3_path = setup_s3
1010
@aws_cli = RSpecTracer.use_local_aws ? 'awslocal' : 'aws'
11+
@use_test_suite_id_cache = ENV['USE_TEST_SUITE_ID_CACHE'] == 'true'
12+
@test_suite_id = ENV['TEST_SUITE_ID'] if @use_test_suite_id_cache
1113
end
1214

1315
def branch_refs?(branch_name)
@@ -60,7 +62,11 @@ def upload_branch_refs(branch_name, file_name)
6062
end
6163

6264
def cache_files_list(ref)
63-
prefix = "s3://#{@s3_bucket}/#{@s3_path}/#{ref}/"
65+
if @use_test_suite_id_cache && !@test_suite_id.nil?
66+
prefix = "s3://#{@s3_bucket}/#{@s3_path}/#{ref}/#{@test_suite_id}/"
67+
else
68+
prefix = "s3://#{@s3_bucket}/#{@s3_path}/#{ref}/"
69+
end
6470

6571
`#{@aws_cli} s3 ls #{prefix} --recursive`.chomp.split("\n")
6672
end

0 commit comments

Comments
 (0)