Skip to content

FIIT-Databases/tester

Repository files navigation

TesterDBS

A tool for automating the testing process for database assignments in the Database Technologies course at the Slovak University of Technology.

The tool takes a student's Docker container as input, creates a sandbox environment using Docker, and executes predefined testing scenarios consisting of HTTP requests and their expected responses. The output is a comparison of the actual responses generated by the student's image and the expected responses. The tool utilizes Docker and Redis for efficient processing.

Install

Application use these environments variables:

Variable Description Default Example
BASE_URL Base URL of the application - https://tester-dbs.fiit.stuba.sk
ALLOWED_HOSTS Allowed hosts (Django Setting) - tester-dbs.fiit.stuba.sk
DATABASE_HOST Database server location - docker.for.mac.localhost
DATABASE_NAME Database name - tester
DATABASE_PASSWORD Database user password super-secure-password
DATABASE_PORT Database port 5432 5432
DATABASE_USER Database user - tester
DJANGO_SETTINGS_MODULE Django Settings Module dbs_tester.settings.development dbs_tester.settings.production
REDIS_HOST Redis host host.docker.internal host.docker.internal
REDIS_DB Redis database 0 0
REDIS_DB Redis database 0 0
REDIS_DB Redis database 0 0
SECRET_KEY Django secret - ghp_asdqwjdsncvsdv
GITHUB_TOKEN GitHub token - Secure-random-string-21
GITHUB_USER GitHub username - Sibyx
DBS_DOCKER_NETWORK Docker network for assignment containers dbs dbs

Docker

Dockerfile contains two targets which are pre-build and available on GitHub Container registry:

Example of configuration is present in compose.yml.

The containers require access to the Docker environment that's why you have to create volume, which maps a path to the Docker socket.

Repository contains an example of the systemd unit script in the conf/tester-dbs.service.

From source

We use poetry for dependency management and PostgreSQL 15 (10+ should be compatible) as a data storage (acquisition files are stored on the filesystem, not in the database). To set up instance with demo database follow these simple steps:

  1. Create python virtual environment (python -m venv venv)
  2. Enter environment (source venv/bin/activate)
  3. Install dependencies poetry install
  4. Create .env file according .env.example
  5. Execute migrations python manage.py migrate
  6. Create superuser using python manage.py createsuperuser or setup LDAP in auth_sources table

Docs

For more information check the docs directory.

The key concepts of this software are described in the blog post How We Built an Application to Test Student Docker Images for a Database Systems University Course.

This blog post was later extended and presented at Communication and Information Technologies (KIT) 2023 with the article Docker-Based Assignment Evaluations in E-Learning.


Made with ❤️ and ☕️ FIIT STU (c) 2022-2024