Sha256: f73fb42180fcb768c294ed3c9ccb1856216747f29b74bcbe129ebf1c55f35da3

Contents?: true

Size: 1.37 KB

Versions: 36

Compression:

Stored size: 1.37 KB

Contents

describe HybridPlatformsConductor::ActionsExecutor do

  context 'checking actions\' plugin bash' do

    it 'executes local Bash code' do
      with_test_platform_for_action_plugins do |repository|
        expect(test_actions_executor.execute_actions('node' => {
          bash: "echo TestContent >#{repository}/test_file ; echo TestStdout ; echo TestStderr 1>&2"
        })['node']).to eq [0, "TestStdout\n", "TestStderr\n"]
        expect(File.read("#{repository}/test_file")).to eq "TestContent\n"
      end
    end

    it 'executes local Bash code with timeout' do
      with_test_platform_for_action_plugins do |repository|
        expect(test_actions_executor.execute_actions(
          { 'node' => {
            bash: 'sleep 2 ; echo ShouldNotReach'
          } },
          timeout: 1
        )['node']).to eq [:timeout, '', '']
      end
    end

    it 'logs local Bash code' do
      with_repository 'logs' do |logs_dir|
        with_test_platform_for_action_plugins do |repository|
          test_actions_executor.execute_actions({
            'node' => {
              bash: 'echo TestStdout ; sleep 1 ; echo TestStderr 1>&2'
            } },
            log_to_dir: logs_dir
          )
          expect(File.exist?("#{logs_dir}/node.stdout")).to eq true
          expect(File.read("#{logs_dir}/node.stdout")).to eq "TestStdout\nTestStderr\n"
        end
      end
    end

  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.0.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.18.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.17.1 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.17.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.16.4 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.16.3 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.16.2 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.16.1 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.16.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.15.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.14.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.13.4 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.13.3 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.13.2 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.13.1 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.13.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.12.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.11.2 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.11.1 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb
hybrid_platforms_conductor-32.11.0 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb