Exemple #1
0
    def test_status_including_branch(self):
        self.channel_map.channel_map.append(
            MappedChannel(
                channel="2.1/stable/hotfix1",
                architecture="amd64",
                expiration_date="2020-02-03T20:58:37Z",
                revision=20,
                progressive=Progressive(
                    paused=None, percentage=None, current_percentage=None
                ),
            )
        )
        self.channel_map.revisions.append(
            Revision(architectures=["amd64"], revision=20, version="10hotfix")
        )
        self.channel_map.snap.channels.append(
            SnapChannel(
                name="2.1/stable/hotfix1",
                track="2.1",
                risk="stable",
                branch="hotfix1",
                fallback="2.1/stable",
            )
        )

        result = self.run_command(["status", "snap-test"])

        self.assertThat(result.exit_code, Equals(0))
        self.assertThat(
            result.output,
            Equals(
                dedent(
                    """\
            Track    Arch    Channel         Version    Revision    Expires at
            2.1      amd64   stable          -          -
                             stable/hotfix1  10hotfix   20          2020-02-03T20:58:37Z
                             candidate       -          -
                             beta            10         19
                             edge            ↑          ↑
            """
                )
            ),
        )
    def test_progressive_status_including_branch(self):
        self.channel_map.channel_map.append(
            MappedChannel(
                channel="2.1/stable/hotfix1",
                architecture="amd64",
                expiration_date="2020-02-03T20:58:37Z",
                revision=20,
                progressive=Progressive(key="foo",
                                        paused=None,
                                        percentage=20.0),
            ))
        self.channel_map.revisions.append(
            Revision(architectures=["amd64"], revision=20, version="10hotfix"))
        self.channel_map.snap.channels.append(
            SnapChannel(
                name="2.1/stable/hotfix1",
                track="2.1",
                risk="stable",
                branch="hotfix1",
                fallback="2.1/stable",
            ))

        result = self.run_command(
            ["status", "snap-test", "--experimental-progressive-releases"])

        self.assertThat(result.exit_code, Equals(0))
        self.assertThat(
            result.output,
            Equals(
                dedent("""\
            *EXPERIMENTAL* progressive releases in use.
            Track    Arch    Channel         Version    Revision    Progress    Expires at
            2.1      amd64   stable          -          -           -
                             stable/hotfix1  10hotfix   20          → 20%       2020-02-03T20:58:37Z
                             candidate       -          -           -
                             beta            10         19          -
                             edge            ↑          ↑           -
            """)),
        )
Exemple #3
0
    def test_progressive_release_with_branch(self):
        self.fake_store_release.mock.return_value = {
            "opened_channels": ["2.1/stable/hotfix1"]
        }
        self.channel_map.channel_map.append(
            MappedChannel(
                channel="2.1/stable/hotfix1",
                architecture="amd64",
                expiration_date="2020-02-03T20:58:37Z",
                revision=20,
                progressive=Progressive(
                    paused=None, percentage=80.0, current_percentage=None
                ),
            )
        )
        self.channel_map.revisions.append(
            Revision(architectures=["amd64"], revision=20, version="10hotfix")
        )
        self.channel_map.snap.channels.append(
            SnapChannel(
                name="2.1/stable/hotfix1",
                track="2.1",
                risk="stable",
                branch="hotfix1",
                fallback="2.1/stable",
            )
        )

        result = self.run_command(
            [
                "release",
                "--progressive",
                "80",
                "--experimental-progressive-releases",
                "nil-snap",
                "20",
                "2.1/stable/hotfix1",
            ]
        )

        self.assertThat(result.exit_code, Equals(0))
        self.assertThat(
            result.output,
            Equals(
                dedent(
                    """\
            *EXPERIMENTAL* progressive releases in use.
            Track    Arch    Channel         Version    Revision    Progress    Expires at
            2.1      amd64   stable          -          -           -
                             stable/hotfix1  10hotfix   20          ?→80%       2020-02-03T20:58:37Z
                             candidate       -          -           -
                             beta            10         19          -
                             edge            ↑          ↑           -
            The '2.1/stable/hotfix1' channel is now open.
                    """
                )
            ),
        )
        self.fake_store_release.mock.assert_called_once_with(
            snap_name="nil-snap",
            revision="20",
            channels=["2.1/stable/hotfix1"],
            progressive_percentage=80,
        )