fix: classify upstream failures and prevent empty billed responses
This commit is contained in:
1 parent
b455d8d79f
commit
9acc69d4c7
28 files changed
+1449
-131
No files matched your search
@@ -37,6 +37,25 @@ def configuration():
|
||||
|
||||
|
||||
class DeploymentTests(unittest.TestCase):
|
||||
def test_duplicate_empty_secret_is_rejected_before_compose(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
env_file = Path(directory) / ".env.cloud"
|
||||
env_file.write_text("TRIPO_API_KEY=private-test-value\nTRIPO_API_KEY=\n", encoding="utf-8")
|
||||
env_file.chmod(0o600)
|
||||
with patch.object(deploy, "execute") as execute:
|
||||
with self.assertRaisesRegex(ValueError, "Duplicate environment setting: TRIPO_API_KEY") as error:
|
||||
deploy.load_config(env_file, "https")
|
||||
self.assertNotIn("private-test-value", str(error.exception))
|
||||
execute.assert_not_called()
|
||||
|
||||
def test_commented_assignment_does_not_override_secret(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
env_file = Path(directory) / ".env.cloud"
|
||||
env_file.write_text("# TRIPO_API_KEY=\nTRIPO_API_KEY=private-test-value\n", encoding="utf-8")
|
||||
env_file.chmod(0o600)
|
||||
with patch.object(deploy, "execute", return_value=json.dumps(configuration())):
|
||||
self.assertEqual(deploy.load_config(env_file, "https"), configuration())
|
||||
|
||||
def test_proxy_replaces_forwarding_headers_for_verification_limits(self):
|
||||
routes = (DIRECTORY / "nginx" / "routes.conf").read_text(encoding="utf-8")
|
||||
self.assertEqual(routes.count('proxy_set_header Forwarded "";'), 2)
|
||||
|
||||
Reference in new issue
Block a user