Esempio n. 1
0
    def testAutoRoll(self):
        TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()

        # TODO(machenbach): Get rid of the editor check in automatic mode.
        os.environ["EDITOR"] = "vi"

        self.ExpectReadURL([
            [
                "https://v8-status.appspot.com/lkgr",
                Exception("Network problem")
            ],
            ["https://v8-status.appspot.com/lkgr", "100"],
        ])

        self.ExpectGit([
            ["status -s -uno", ""],
            ["status -s -b -uno", "## some_branch\n"],
            ["svn fetch", ""],
            ["svn log -1 --oneline", "r101 | Text"],
        ])

        # TODO(machenbach): Make a convenience wrapper for this.
        class Options(object):
            pass

        options = Options()
        options.s = 0

        auto_roll.RunAutoRoll(TEST_CONFIG, options, self)

        self.assertEquals("100", self.MakeStep().Restore("lkgr"))
        self.assertEquals("101", self.MakeStep().Restore("latest"))
Esempio n. 2
0
    def testAutoRoll(self):
        TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()

        self.ExpectReadURL([
            [
                "https://v8-status.appspot.com/lkgr",
                Exception("Network problem")
            ],
            ["https://v8-status.appspot.com/lkgr", "100"],
        ])

        self.ExpectGit([
            ["status -s -uno", ""],
            ["status -s -b -uno", "## some_branch\n"],
            ["svn fetch", ""],
            ["svn log -1 --oneline", "r101 | Text"],
            [
                "svn log -1 --oneline ChangeLog",
                "r65 | Prepare push to trunk..."
            ],
        ])

        auto_roll.RunAutoRoll(TEST_CONFIG, MakeOptions(m=False, f=True), self)

        self.assertEquals("100", self.MakeStep().Restore("lkgr"))
        self.assertEquals("101", self.MakeStep().Restore("latest"))
Esempio n. 3
0
    def testAutoRoll(self):
        status_password = self.MakeEmptyTempFile()
        TextToFile("PW", status_password)
        TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
        TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"

        self.ExpectReadURL([
            [
                "https://v8-status.appspot.com/current?format=json",
                "{\"message\": \"Tree is throttled\"}"
            ],
            [
                "https://v8-status.appspot.com/lkgr",
                Exception("Network problem")
            ],
            ["https://v8-status.appspot.com/lkgr", "100"],
            [
                "https://v8-status.appspot.com/status",
                ("username=v8-auto-roll%40chromium.org&"
                 "message=Tree+is+closed+%28preparing+to+push%29&password=PW"),
                ""
            ],
            [
                "https://v8-status.appspot.com/status",
                ("username=v8-auto-roll%40chromium.org&"
                 "message=Tree+is+throttled&password=PW"), ""
            ],
        ])

        self.ExpectGit([
            ["status -s -uno", ""],
            ["status -s -b -uno", "## some_branch\n"],
            ["svn fetch", ""],
            ["svn log -1 --oneline", "r100 | Text"],
            [("log -1 --format=%H --grep=\""
              "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\""
              " svn/trunk"), "push_hash\n"],
            ["svn find-rev push_hash", "65"],
        ])

        auto_roll.RunAutoRoll(
            TEST_CONFIG,
            AutoRollOptions(MakeOptions(status_password=status_password)),
            self)

        state = json.loads(
            FileToText("%s-state.json" % TEST_CONFIG[PERSISTFILE_BASENAME]))

        self.assertEquals("100", state["lkgr"])
        self.assertEquals("100", state["latest"])
Esempio n. 4
0
    def testAutoRoll(self):
        status_password = self.MakeEmptyTempFile()
        TextToFile("PW", status_password)
        TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
        TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"

        self.ExpectReadURL([
            [
                "https://v8-status.appspot.com/current?format=json",
                "{\"message\": \"Tree is throttled\"}"
            ],
            [
                "https://v8-status.appspot.com/lkgr",
                Exception("Network problem")
            ],
            ["https://v8-status.appspot.com/lkgr", "100"],
            [
                "https://v8-status.appspot.com/status",
                ("username=v8-auto-roll%40chromium.org&"
                 "message=Tree+is+closed+%28preparing+to+push%29&password=PW"),
                ""
            ],
            [
                "https://v8-status.appspot.com/status",
                ("username=v8-auto-roll%40chromium.org&"
                 "message=Tree+is+throttled&password=PW"), ""
            ],
        ])

        self.ExpectGit([
            ["status -s -uno", ""],
            ["status -s -b -uno", "## some_branch\n"],
            ["svn fetch", ""],
            ["svn log -1 --oneline", "r100 | Text"],
            [
                "svn log -1 --oneline ChangeLog",
                "r65 | Prepare push to trunk..."
            ],
        ])

        auto_roll.RunAutoRoll(
            TEST_CONFIG,
            AutoRollOptions(MakeOptions(status_password=status_password)),
            self)

        self.assertEquals("100", self.MakeStep().Restore("lkgr"))
        self.assertEquals("100", self.MakeStep().Restore("latest"))
Esempio n. 5
0
 def RunAutoRoll():
     auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(MakeOptions()),
                           self)
Esempio n. 6
0
 def RunAutoRoll():
     auto_roll.RunAutoRoll(TEST_CONFIG, AutoRollOptions(options), self)