<commit_before>require 'spec_helper'

describe 'tests using a profile with a role' do
    #before(:each) do
    #  ENV['AWS_PROFILE']='circle-role'
    #end

    #after(:each) do
    #  ENV.delete('AWS_PROFILE')
    #end

    #describe command ('aws-runas -vs') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #  its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #  its(:stderr) { should match /\s+Found cached session token credentials/ }
    #  its(:stderr) { should_not match /\s+ASSUME ROLE OUTPUT:/ }
    #end

    #describe command ('aws-runas -vse') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stderr) { should match /\s+Found cached session token credentials/ }
    #  its(:stderr) { should match /^Session credentials will expire on/ }
    #end

    #describe command ('aws-runas -vsrd 10m') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #  its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #  its(:stderr) { should match /\s+Detected expired or unset session token credentials, refreshing/ }
    #end

    #describe command ('aws-runas -vsrd 360h') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #  its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #  its(:stderr) { should match /\s+Detected expired or unset session token credentials, refreshing/ }
    #end

    #describe command ('aws-runas -vsrd 1d') do
    #  its(:exit_status) { should_not eq 0 }
    #  its(:stderr) { should match /\s+unknown unit d in duration 1d/ }
    #end


    describe command ('aws-runas -v arn:aws:iam::686784119290:role/circleci-role') do
      its(:exit_status) { should eq 0 }
      its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
      its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
      its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
      its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
      its(:stderr) { should match /\s+ASSUME ROLE OUTPUT:/ }
    end

    describe command ('aws-runas -ve arn:aws:iam::686784119290:role/circleci-role') do
      its(:exit_status) { should eq 0 }
      its(:stderr) { should match /\s+Found cached session token credentials/ }
      its(:stderr) { should match /^Session credentials will expire on/ }
      its(:stderr) { should match /\s+ASSUME ROLE OUTPUT:/ }
    end

    #    describe command ('aws-runas -vrd 10m') do
    #      its(:exit_status) { should eq 0 }
    #      its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #      its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #      its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #      its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #      its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #      its(:stderr) { should match /\s+Detected expired or unset session token credentials, refreshing/ }<commit_msg>Try setting role arn in AWS_PROFILE env var<commit_after>require 'spec_helper'

describe 'tests using a profile with a role' do
    before(:each) do
      ENV['AWS_PROFILE']='arn:aws:iam::686784119290:role/circleci-role'
    end

    after(:each) do
      ENV.delete('AWS_PROFILE')
    end

    #describe command ('aws-runas -vs') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #  its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #  its(:stderr) { should match /\s+Found cached session token credentials/ }
    #  its(:stderr) { should_not match /\s+ASSUME ROLE OUTPUT:/ }
    #end

    #describe command ('aws-runas -vse') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stderr) { should match /\s+Found cached session token credentials/ }
    #  its(:stderr) { should match /^Session credentials will expire on/ }
    #end

    #describe command ('aws-runas -vsrd 10m') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #  its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #  its(:stderr) { should match /\s+Detected expired or unset session token credentials, refreshing/ }
    #end

    #describe command ('aws-runas -vsrd 360h') do
    #  its(:exit_status) { should eq 0 }
    #  its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #  its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #  its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #  its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #  its(:stderr) { should match /\s+Detected expired or unset session token credentials, refreshing/ }
    #end

    #describe command ('aws-runas -vsrd 1d') do
    #  its(:exit_status) { should_not eq 0 }
    #  its(:stderr) { should match /\s+unknown unit d in duration 1d/ }
    #end


    describe command ('aws-runas -v') do
      its(:exit_status) { should eq 0 }
      its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
      its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
      its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
      its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
      its(:stderr) { should match /\s+ASSUME ROLE OUTPUT:/ }
    end

    describe command ('aws-runas -ve') do
      its(:exit_status) { should eq 0 }
      its(:stderr) { should match /\s+Found cached session token credentials/ }
      its(:stderr) { should match /^Session credentials will expire on/ }
      its(:stderr) { should match /\s+ASSUME ROLE OUTPUT:/ }
    end

    #    describe command ('aws-runas -vrd 10m') do
    #      its(:exit_status) { should eq 0 }
    #      its(:stdout) { should match /^export AWS_REGION='.*'$/ }
    #      its(:stdout) { should match /^export AWS_ACCESS_KEY_ID='ASIA\w+'$/ }
    #      its(:stdout) { should match /^export AWS_SECRET_ACCESS_KEY='.*'$/ }
    #      its(:stdout) { should match /^export AWS_SESSION_TOKEN='.*'$/ }
    #      its(:stdout) { should match /^export AWS_SECURITY_TOKEN='.*'$/ }
    #      its(:stderr) { should match /\s+Detected expired or unset session token credentials, refreshing/ }
{'fraction_non_alphanumeric': 0.1646143875567077, 'fraction_numerical': 0.009073233959818535, 'mean_word_length': 3.0546505517603784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '736410', 'n_tokens_mistral': 2714, 'n_tokens_neox': 2610, 'n_words': 663}