← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:git-repack-test-robustness into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:git-repack-test-robustness into launchpad:master.

Commit message:
Avoid test failure if git.launchpad.test exists

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/450115

The development config has `internal_git_api_endpoint` set to `http://git.launchpad.test:19417/`, which is mostly reasonable except that it causes `TestRequestGitRepack.test_auto_repack_without_Turnip` to fail if the test system happens to have a `git.launchpad.test` up and running and listed in its `/etc/hosts`.  Ensure that this test is isolated from any such thing.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:git-repack-test-robustness into launchpad:master.
diff --git a/lib/lp/code/scripts/tests/test_repack_git_repositories.py b/lib/lp/code/scripts/tests/test_repack_git_repositories.py
index 25cff03..9f2422d 100644
--- a/lib/lp/code/scripts/tests/test_repack_git_repositories.py
+++ b/lib/lp/code/scripts/tests/test_repack_git_repositories.py
@@ -114,6 +114,17 @@ class TestRequestGitRepack(TestCaseWithFactory):
         repo.loose_object_count = 7000
         repo.pack_count = 43
 
+        config_name = self.factory.getUniqueString()
+        config_fixture = self.useFixture(
+            ConfigFixture(config_name, config.instance_name)
+        )
+        setting_lines = [
+            "[codehosting]",
+            "internal_git_api_endpoint: http://nonexistent.test/";,
+        ]
+        config_fixture.add_section("\n" + "\n".join(setting_lines))
+        self.useFixture(ConfigUseFixture(config_name))
+
         # Do not start the fake turnip server here
         # to test if the RequestGitRepack will catch and
         # log correctly the failure to establish