From 240313e09d7cf042e675777658a7782ea8981985 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Thu, 26 Sep 2024 06:25:17 -0700 Subject: [PATCH] filter reads to given run_id --- languages/ruby/spec/e2e_data_manipulation.rb | 10 ++++++++++ languages/ruby/spec/e2e_spec.rb | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/languages/ruby/spec/e2e_data_manipulation.rb b/languages/ruby/spec/e2e_data_manipulation.rb index bb66ade9c..7e2633005 100644 --- a/languages/ruby/spec/e2e_data_manipulation.rb +++ b/languages/ruby/spec/e2e_data_manipulation.rb @@ -7,6 +7,16 @@ def with_run_id(str) "#{str}-#{run_id}" end +def filter_projects_to_this_run(projects) + run_id = env('RUN_ID') + projects.filter { |p| p['name'].end_with? run_id } +end + +def filter_secrets_to_this_run(secrets) + run_id = env('RUN_ID') + secrets.filter { |p| p['key'].end_with? run_id } +end + def project_with_run_id(project) project['name'] = with_run_id project['name'] project diff --git a/languages/ruby/spec/e2e_spec.rb b/languages/ruby/spec/e2e_spec.rb index 10144ffb5..05d036d51 100644 --- a/languages/ruby/spec/e2e_spec.rb +++ b/languages/ruby/spec/e2e_spec.rb @@ -34,8 +34,10 @@ let(:expected_data) { JSON.parse(File.read(expected_data_file)) } let(:expected_projects) { expected_data['projects'].map { |p| project_with_run_id p } } let(:expected_secrets) { expected_data['secrets'].map { |s| secret_with_project_id(secret_with_run_id(s), projects) } } - let(:projects) { @client.projects.list(organization_id) } - let(:secrets) { @client.secrets.list(organization_id) } + let(:all_projects) { @client.projects.list(organization_id).filter } + let(:projects) { filter_projects_to_this_run(all_projects) } + let(:all_secrets) { @client.secrets.list(organization_id) } + let(:secrets) { filter_secrets_to_this_run(all_secrets) } before(:all) do # Set up client