Skip to content

Commit

Permalink
Test binary download from dummy server
Browse files Browse the repository at this point in the history
  • Loading branch information
svolland-csgroup committed Jan 20, 2023
1 parent b73aca4 commit 9a453bd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
push: false
outputs: type=docker,dest=/tmp/k8s-sidecar.tar
tags: "kiwigrid/k8s-sidecar:testing"
- name: Prepare dummy server static resources
run: |
cp test/kubelogo.png test/server/static/
- name: Build dummy server
uses: docker/build-push-action@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions test/resources/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ metadata:
labels:
findme: "yup"
binaryData:
# Base64 encoded url is 'https://github.com/kiwigrid/k8s-sidecar/raw/master/test/kubelogo.png'
url-downloaded-kubelogo.png.url: "aHR0cHM6Ly9naXRodWIuY29tL2tpd2lncmlkL2s4cy1zaWRlY2FyL3Jhdy9tYXN0ZXIvdGVzdC9rdWJlbG9nby5wbmc="
# Base64 encoded url is 'http://dummy-server/static/kubelogo.png'
url-downloaded-kubelogo.png.url: "aHR0cDovL2R1bW15LXNlcnZlci9zdGF0aWMva3ViZWxvZ28ucG5n"
1 change: 1 addition & 0 deletions test/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ FROM python:3.9-alpine
RUN pip install fastapi uvicorn
EXPOSE 80
COPY server.py /server.py
COPY static /static/
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "80"]
3 changes: 3 additions & 0 deletions test/server/server.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from fastapi import Depends, FastAPI, status, HTTPException
from fastapi.logger import logger
from fastapi.security import HTTPBasic, HTTPBasicCredentials
from fastapi.staticfiles import StaticFiles
from starlette.responses import PlainTextResponse

app = FastAPI()

app.mount("/static", StaticFiles(directory="static"), name="static")

basic_auth_scheme = HTTPBasic()


Expand Down

0 comments on commit 9a453bd

Please sign in to comment.