Skip to content

Commit

Permalink
tests: http io
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Pfitzner committed Aug 13, 2024
1 parent b11b9f6 commit eaa7288
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
import requests
import hashlib
from time import sleep

import pytest
Expand Down Expand Up @@ -150,3 +152,26 @@ def test_network_nfs_io(shell):
assert len(file) > 0

shell.run_check(f"rm {file[0]}")

def test_network_http_io(strategy, shell):
"""Test http server file io"""

# Create test file
shell.run_check("dd if=/dev/random of=/srv/www/test_file bs=1M count=15")
output, _, returncode = shell.run("md5sum /srv/www/test_file")
assert returncode == 0
assert len(output) > 0

# Cut out hash from output
checksum1 = output[0].split(' ')[0]

# Download test file
r = requests.get(f"http://{strategy.network.address}/srv/test_file")
assert r.status_code == 200

checksum2 = hashlib.md5(r.content).hexdigest()

assert checksum1 == checksum2, f"checksums are different: {checksum1} != {checksum2}"

# Delete test file
shell.run_check("rm /srv/www/test_file")

0 comments on commit eaa7288

Please sign in to comment.