Code Monkey home page Code Monkey logo

teste's Introduction

Kubernetes, Docker and Python API test

Starting the Companies API

Requirements

  • Docker
  • Python 3+
  • Kubernetes cluster: See more about instalation of Minikube, k3s, Microk8s or Kind
  • Linux OS or WSL

Command to run

cd api && sh run_api.sh

This command will create a Dockerfile and start Companies API pod in the Kubernetes cluster, under current namespace.

It's required that the cluster works with Docker local images

Exercise 1

Create a Python API that responds to the path /test_api (Flask recommended, but feel free with other Python modules).

This API must receive data as JSON with keys: url and status code. The output must be the result of an GET HTTP request to the provided url and check if the status code of the request is the same as provided in payload.

To test it with Companies API, in Kubernetes cluster there is a pod called "api", find its IP. Then:

curl http://api_ip:5000/companies

The output of Companies API is something like this:

[{"id": 1, "name": "Company One"}, {"id": 2, "name": "Company Two"}]

The status code of the request is 200

Obs: Your API will receive Companies API url and a status code and test it.

Exercise 2

Create a Docker image adding the API created in exercise 1. The build will save the image under the localhost.

Exercise 3

Create a pod that will run image created in exercise 2.

Exercise 4

Test the API running on pod created in exercise 3.

teste's People

Contributors

valmiranogueira avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.