Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some small fixes #39

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3scale/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ http {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection $http_connection;

# Pass ETag header from Cockpit to clients.
# See: https://github.com/cockpit-project/cockpit/issues/5239
Expand Down
1 change: 0 additions & 1 deletion appservice/multiplexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def new_session_podman(self, sessionid):
"> /tmp/conf/cockpit/cockpit.conf;"
"export XDG_CONFIG_DIRS=/tmp/conf;"
"exec /usr/libexec/cockpit-ws --for-tls-proxy --local-session=socat-session.sh"],
'remove': True,
'netns': {'nsmode': 'bridge'},
# deprecated; use this with podman ≥ 4: 'Networks': {'consoledot': {}},
'cni_networks': ['consoledot'],
Expand Down
16 changes: 11 additions & 5 deletions test/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,36 @@ def tearDown(self):

subprocess.check_call(['make', 'clean'], cwd=projroot)

def request(self, url, retries=0):
@staticmethod
def get_auth_request(url):
b64 = base64.b64encode(b'admin:foobar').decode()

request = urllib.request.Request(url)
request.add_header('Authorization', f'Basic {b64}')
tries = 0
return request

def request(self, url, retries=0):
request = self.get_auth_request(url)
tries = 0
last_exc = None
while tries <= retries:
try:
response = urllib.request.urlopen(request, context=self.ssl_3scale, timeout=1)
if response.status >= 200 and response.status < 300:
return response
except urllib.error.HTTPError as exc:
last_exc = exc
if 'Bad Gateway' in str(exc):
pass
else:
raise
except TimeoutError:
pass
except TimeoutError as exc:
last_exc = exc

time.sleep(1)
tries += 1

self.fail(f'timeout reached trying to request {url}')
self.fail(f'timeout reached trying to request {url}: {last_exc}')

def newSession(self):
response = self.request(f'{self.api_url}{config.ROUTE_API}/sessions/new')
Expand Down