Sha256: bfd05f6fcdafeb08651b4581c430929a81b77bd3a2c747bcf680dcb0f1d927f7

Contents?: true

Size: 1.43 KB

Versions: 1

Compression:

Stored size: 1.43 KB

Contents

describe HybridPlatformsConductor::ActionsExecutor do

  context 'when 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
        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
          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

1 entries across 1 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.0.1 spec/hybrid_platforms_conductor_test/api/actions_executor/actions/bash_spec.rb