Exemplo n.º 1
0
 def test_process_variables_set(self):
     options = PortableOptions([
         '--environment_type=PROCESS',
         '--environment_option=process_command=foo',
         '--environment_option=process_variables='
         'BASH_VARIABLE_ONE=spam,BASH_VARIABLE_TWO=ham',
         '--sdk_location=container'
     ])
     environment = ProcessEnvironment.from_options(options)
     self.assertEqual(environment.command, 'foo')
     self.assertEqual(environment.env, {
         'BASH_VARIABLE_ONE': 'spam',
         'BASH_VARIABLE_TWO': 'ham'
     })
Exemplo n.º 2
0
 def test_environment_encoding(self):
     for environment in (DockerEnvironment(),
                         DockerEnvironment(container_image='img'),
                         DockerEnvironment(capabilities=['x, y, z']),
                         ProcessEnvironment('run.sh'),
                         ProcessEnvironment('run.sh',
                                            os='linux',
                                            arch='amd64',
                                            env={'k1': 'v1'}),
                         ExternalEnvironment('localhost:8080'),
                         ExternalEnvironment('localhost:8080',
                                             params={'k1': 'v1'}),
                         EmbeddedPythonEnvironment(),
                         EmbeddedPythonGrpcEnvironment(),
                         EmbeddedPythonGrpcEnvironment(
                             state_cache_size=0,
                             data_buffer_time_limit_ms=0),
                         SubprocessSDKEnvironment(command_string=u'foö')):
         context = pipeline_context.PipelineContext()
         proto = environment.to_runner_api(context)
         reconstructed = Environment.from_runner_api(proto, context)
         self.assertEqual(environment, reconstructed)
         self.assertEqual(proto, reconstructed.to_runner_api(context))