/devops-2

Primary LanguageHCL

DevOps Labs

Test

Table of Contents

  1. Python App
    1. Getting started
    2. Usage example
  2. Docker
    1. Building an image
    2. Launching the prebuilt image
  3. Unit Tests
  4. Acknowledgements

Python App

A Flask app displaying current time in Moscow.

Getting started

To get a local copy up and running follow these simple steps.

Prerequisites

  • python3

Installation

  • Clone the repo
git clone https://github.com/Delt06/devops
  • Go to the app_python directory
cd ./devops/app_python
  • Install pip requirements
pip install -r /path/to/requirements.txt

Usage example

  • Launch the app
flask run
  • Open the app by the suggested link
  • Go to <suggested link>/visits to view the times when you visited the root (/) page

Docker

A docker image for the Python App.

Building an image

cd ./devops/app_python
  • Launch the build
docker build -t deltation/devops-app-python .

Launching the prebuilt image

docker run -p 5000:5000 deltation/devops-app-python

Launching with docker-compose

  • Go to the app_python directory
cd ./devops/app_python
  • Launch via docker-compose
docker-compose up

Unit Tests

The project contains a test suite for the Python App. The suite relies on the unittest module.

To run tests locally, executes the following command from the app_python folder:

python test.py

Github Actions

The project contains a Test workflow, which is trigger on every push and pull request. The tests are run inside a Docker container. The status of tests is reflected by the badge at the top of this README file.

Acknowledgements