Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e integration tests with docker and testcontainers #753

Merged
merged 1 commit into from Nov 24, 2022
Merged

Conversation

0xERR0R
Copy link
Owner

@0xERR0R 0xERR0R commented Nov 16, 2022

I would like to introduce first step end-to-end integration tests. We do already have good basic unit test coverage, but I think we should also test more complex scenarios with real running system and external dependencies.

Basic idea:

  • start blocky as docker container with defined configuration (as YAML)
  • start also dependent services as docker containers in the same docker network, e.g.
    • database (mysql, postgres) for query log
    • redis
    • upstream DNS server(s)
    • http server for list downloads
    • ...
  • do tests as black box (by using DNS queries (plain, DoH, DoT) or by calling REST/Cli endpoints)

I created a project DNS MOKKA which can be used as external upstream DNS server. This tool returns predefined answers (DNS responses, DNS errors or answers with delay), so it is easy to assert results.

This PR adds basic tests with all external services (mostly only happy path).

Tests can be execution with make e2e-test

GitHub action executes all e2e-tests on each push and PR

Opinions, ideas and suggestions are welcome 🤝

@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Base: 92.82% // Head: 88.23% // Decreases project coverage by -4.59% ⚠️

Coverage data is based on head (87e9200) compared to base (d4813a6).
Patch coverage: 0.00% of modified lines in pull request are covered.

❗ Current head 87e9200 differs from pull request most recent head 4cd28db. Consider uploading reports for the commit 4cd28db to get more accurate results

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #753      +/-   ##
===============================================
- Coverage        92.82%   88.23%   -4.60%     
===============================================
  Files               41       41              
  Lines             4644     4794     +150     
===============================================
- Hits              4311     4230      -81     
- Misses             264      494     +230     
- Partials            69       70       +1     
Impacted Files Coverage Δ
e2e/containers.go 0.00% <0.00%> (ø)
redis/redis.go 66.32% <0.00%> (-25.95%) ⬇️
querylog/database_writer.go 82.17% <0.00%> (-0.18%) ⬇️
config/config.go 88.73% <0.00%> (ø)
querylog/file_writer.go 100.00% <0.00%> (ø)
querylog/logger_writer.go 100.00% <0.00%> (ø)
util/hostname.go

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@0xERR0R 0xERR0R force-pushed the e2e-tests branch 2 times, most recently from 87e9200 to b66c78a Compare November 20, 2022 21:23
@0xERR0R 0xERR0R changed the title Draft: [WIP] e2e integration tests with docker and testcontainers e2e integration tests with docker and testcontainers Nov 20, 2022
@0xERR0R 0xERR0R marked this pull request as ready for review November 20, 2022 21:27
@0xERR0R 0xERR0R added this to the 0.21 milestone Nov 20, 2022
@0xERR0R 0xERR0R force-pushed the e2e-tests branch 7 times, most recently from ec9902a to cc43736 Compare November 21, 2022 14:18
@0xERR0R 0xERR0R requested a review from kwitsch November 21, 2022 14:55
@kwitsch
Copy link
Collaborator

kwitsch commented Nov 21, 2022

Looks very nice. 👍
Will review it during the week.

@0xERR0R 0xERR0R added the 🧰 technical debts Technical debts, refactoring label Nov 22, 2022
Copy link
Collaborator

@kwitsch kwitsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks consistent 👍

Dockerfile Show resolved Hide resolved
@0xERR0R 0xERR0R merged commit fb0810f into development Nov 24, 2022
@delete-merged-branch delete-merged-branch bot deleted the e2e-tests branch November 24, 2022 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧰 technical debts Technical debts, refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants