コード例 #1
0
    def run(self):
        """Run tests."""
        self.clean()
        self.set_environment("dev")
        self.deploy()
        with change_dir(self.sources_test_dir):
            self.logger.info(os.path.isdir(".runway_cache"))
            assert os.path.isdir(".runway_cache")

        change_dir(self.base_dir)
コード例 #2
0
 def teardown(self):
     """Teardown."""
     self.logger.info("Tearing down: %s", self.TEST_NAME)
     self.delete_venv(self.module_dir)
     with change_dir(self.staticsite_test_dir):
         run_command(["runway", "destroy"])
     self.clean()
コード例 #3
0
ファイル: integration_test.py プロジェクト: akshitkh/runway
    def runway_cmd(self, action, *args, env_vars=None, tags=None, timeout=900):
        """Run a deploy command based on tags.

        Args:
            action (str): Runway action. (e.g. ``deploy``, ``destroy``)
            env_vars (Optional[Dict[str, str]]): Can be used to override
                environment variables for the invocation.
            tags (Optional[List[str]]): List of tag options to pass to Runway.
            timeout (int): Seconds to wait for process to complete.
            args (str): Additional arguments to add to the command. These
                are places after any ``--tag`` options.

        Returns:
            Tuple[int, str, str]: The return code, ``stdout``, and ``stderr``
            of the process.

        """
        cmd = ["runway", action]
        if tags:
            for tag in tags:
                cmd.extend(["--tag", tag])
        cmd.extend(args)
        self.logger.info("Running command: %s", cmd)
        with change_dir(self.working_dir):
            cmd_process = subprocess.Popen(
                cmd,
                env=env_vars or self.environment,
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
                universal_newlines=True,
            )
            stdout, stderr = cmd_process.communicate(timeout=timeout)
            print(stderr)
        return cmd_process.returncode, stdout, stderr
コード例 #4
0
 def teardown(self):
     """Teardown scaffolding."""
     self.set_env_var("CI", "1")
     self.logger.info("Tearing down: %s", self.TEST_NAME)
     with change_dir(self.parallelism_test_dir):
         run_command(["runway", "destroy"])
     self.clean()
コード例 #5
0
ファイル: test_raw.py プロジェクト: onicagroup/runway
def test_get_template_path_local_file(tmp_path: Path) -> None:
    """Verify get_template_path finding a file relative to CWD."""
    template_path = Path("cfn_template.json")
    (tmp_path / "cfn_template.json").touch()

    with change_dir(tmp_path):
        result = get_template_path(template_path)
        assert template_path.samefile(cast(Path, result))
コード例 #6
0
 def deploy(self):
     """Deploy provider."""
     os.mkdir(self.staticsite_test_dir)
     os.mkdir(os.path.join(self.staticsite_test_dir, self.module_dir))
     os.mkdir(
         os.path.join(self.staticsite_test_dir, self.module_dir, "build"))
     self.copy_runway("basic-site")
     with change_dir(self.staticsite_test_dir):
         return run_command(["runway", "deploy"])
コード例 #7
0
ファイル: 16_aws_lambda_hook.py プロジェクト: akshitkh/runway
    def _build(self):
        """Execute and assert initial build.

        Explicitly spawning with a tty here to ensure output
        (e.g. from pip) includes color

        """
        with change_dir(self.working_dir):
            runner = CliRunner()
            result = runner.invoke(
                cli, ["deploy", "--deploy-environment", "dev", "--ci"], color=True
            )
            assert result.exit_code == 0, "exit code should be zero"
            assert (
                "\x1b[31mERROR: " not in result.output
            ), "no red ERROR should be present"
コード例 #8
0
 def deploy(self):
     """Deploy provider."""
     self.copy_fixture("decline-deploy-app.cdk")
     self.copy_runway("decline-deploy")
     with change_dir(self.cdk_test_dir):
         child = pexpect.spawn("runway deploy")
         try:
             child.logfile = sys.stdout.buffer
             child.expect("Do you wish to deploy these changes (y/n)?",
                          timeout=120)
             child.sendline("n")
             i = child.expect("Aborted")
         except pexpect.EOF:
             self.logger.debug("EOF Reached")
             return 0
         else:
             return i
コード例 #9
0
 def deploy(self):
     """Deploy provider."""
     self.copy_runway("git")
     with change_dir(self.sources_test_dir):
         return run_command(["runway", "deploy"])
コード例 #10
0
ファイル: test_two_regions.py プロジェクト: akshitkh/runway
 def deploy(self):
     """Deploy provider."""
     self.copy_fixture("sampleapp.cfn")
     self.copy_runway("two-regions")
     with change_dir(self.parallelism_test_dir):
         return run_command(["runway", "deploy"])
コード例 #11
0
 def deploy(self):
     """Deploy provider."""
     self.copy_fixture(self.module_dir)
     self.copy_runway("multiple-stacks")
     with change_dir(self.cdk_test_dir):
         return run_command(["runway", "deploy"])