pansen / castlabs_challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Castlabs Programming Task

Abstract

This repository tries to cover the challenge as good as possible. Since this is a coding challenge, there are some limitations, some of them are marked as TODO in the code and maybe even mentioned below.

Usage

This repository is intented to be used locally for execution or development.

Local Execution

Prerequisites

  • You need to have UNIX compatible OS
  • You need Docker installed
  • You need docker-compose installed
  • You should have jq installed

Go

To just run the current version, use

docker-compose up --build
Test
Proxy HTTP GET

In an other terminal, you can call

http_proxy=127.0.0.1:8000 curl 'httpbin.org/get?a=1'

or

Proxy HTTP POST
http_proxy=127.0.0.1:8000 curl -X POST 'httpbin.org/post?a=1'

to see the thing in action.

Proxy Status

To see the status of the instance, call

curl -s localhost:8000/status | jq .

Local Development

Prerequisites

  • You need to have UNIX compatible OS

  • You need to have make and Python3.8 installed

  • Probably you also need a C compiler toolchain (not sure about the dependencies)

  • It is assumed you have a Python IDE installed, particulary PyCharm

  • After checkout, run make bootstrap dev.build before opening the project in PyCharm. This ensures to let PyCharm find the venv and its containing local Python interpreter.

  • After opening the project in PyCharm, ensure the projects test-runner is configured to use pytest

    PyCharm Testrunner Configuration

Go

To build your development environment, use

make dev.build

To run all tests, use

make test

Once you followed the prerequisites section, you will also be able to run and debug single tests from PyCharm.

About


Languages

Language:Python 88.4%Language:Makefile 8.3%Language:Dockerfile 1.8%Language:Shell 1.5%