コード例 #1
0
    def test_rule0_1_3(self):
        context = """FROM registry.a.com/acme/centos:8"""
        wrapper = get_last_stage_wrapper(context)

        wrapper.rule0_1_3()

        self.assertEqual(len(wrapper.errors), 1)
        self.assertIn("""Either LABEL maintainer or MAINTAINER is mandatory in last stage""", wrapper.errors[0])
コード例 #2
0
    def test_rule0_1_0(self):
        context = """
        FROM registry.a.com/acme/centos:8
        LABEL maintainer="foo <*****@*****.**>"
        LABEL maintainer="foo <*****@*****.**>"
        """
        wrapper = get_last_stage_wrapper(context)

        wrapper.rule0_1_0()

        self.assertEqual(len(wrapper.errors), 1)
        self.assertIn("""LABEL maintainer must occur at most once in last stage""", wrapper.errors[0])
コード例 #3
0
    def test_rule0_1_1(self):
        context = """
        FROM registry.a.com/acme/centos:8
        MAINTAINER foo <*****@*****.**>
        MAINTAINER foo <*****@*****.**>
        """

        wrapper = get_last_stage_wrapper(context)

        wrapper.rule0_1_1()

        self.assertEqual(len(wrapper.errors), 1)
        self.assertIn("""MAINTAINER must occur at most once in last stage""", wrapper.errors[0])
コード例 #4
0
    def test_rule0_3(self):
        context = """
        FROM registry.a.com/acme/centos:7
        LABEL maintainer="foo <*****@*****.**>"
        ENTRYPOINT ["/basd"]
        ENTRYPOINT ["/basd"]
        """
        wrapper = get_last_stage_wrapper(context)

        wrapper.rule0_3()

        self.assertEqual(len(wrapper.errors), 1)
        self.assertIn("""ENTRYPOINT must occur at most once in last stage""",
                      wrapper.errors[0])
コード例 #5
0
    def test_rule7(self):
        context = """
        FROM registry.a.com/acme/centos:7
        LABEL maintainer="foo <*****@*****.**>"
        CMD ["/basd"]
        ENTRYPOINT ["/basd"]
        """
        wrapper = get_last_stage_wrapper(context)

        wrapper.rule7()

        self.assertEqual(len(wrapper.errors), 1)
        self.assertIn(
            """CMD must be after ENTRYPOINT if both are specified in last stage""",
            wrapper.errors[0])