Example #1
0
    def test_status_by_arch(self):
        self.channel_map.channel_map.append(
            MappedChannel(
                channel="2.1/beta",
                architecture="s390x",
                expiration_date=None,
                revision=99,
                progressive=Progressive(key=None, paused=None,
                                        percentage=None),
            ))
        self.channel_map.revisions.append(
            Revision(architectures=["s390x"], revision=99, version="10"))

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

        self.assertThat(result.exit_code, Equals(0))
        self.assertThat(
            result.output,
            Equals(
                dedent("""\
            Track    Arch    Channel    Version    Revision
            2.1      s390x   stable     -          -
                             candidate  -          -
                             beta       10         99
                             edge       ↑          ↑
            """)),
        )
Example #2
0
    def test_status_following(self):
        self.channel_map.channel_map = [
            MappedChannel(
                channel="2.1/stable",
                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="10"))

        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
            2.1      amd64   stable     10         20
                             candidate  ↑          ↑
                             beta       ↑          ↑
                             edge       ↑          ↑
            """)),
        )
Example #3
0
    def test_progressive_status(self):
        self.channel_map.channel_map.append(
            MappedChannel(
                channel="2.1/beta",
                architecture="amd64",
                expiration_date="2020-02-03T20:58:37Z",
                revision=20,
                progressive=Progressive(paused=None,
                                        percentage=10.0,
                                        current_percentage=7.2),
            ))
        self.channel_map.revisions.append(
            Revision(architectures=["amd64"], revision=20, version="11"))

        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
            2.1      amd64   stable     -          -           -
                             candidate  -          -           -
                             beta       10         19          93→90%
                                        11         20          7→10%
                             edge       ↑          ↑           -
            2.0      amd64   stable     -          -           -
                             candidate  -          -           -
                             beta       10         18          -
                             edge       ↑          ↑           -
            """)),
        )
Example #4
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),
            ))
        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            ↑          ↑
            """)),
        )
Example #5
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,
        )
Example #6
0
    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(paused=None,
                                        percentage=20.0,
                                        current_percentage=12.3),
            ))
        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          12→20%      2020-02-03T20:58:37Z
                             candidate       -          -           -
                             beta            10         19          -
                             edge            ↑          ↑           -
            2.0      amd64   stable          -          -           -
                             candidate       -          -           -
                             beta            10         18          -
                             edge            ↑          ↑           -
            """)),
        )