v0.0.1
This commit is contained in:
parent
8f4cd205ff
commit
81127b7c33
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
dockerfile
|
||||||
|
.gitignore
|
||||||
|
LICENSE
|
||||||
|
README.md
|
7
dockerfile
Normal file
7
dockerfile
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM python:3.9-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD [ "python3", "/app/main.py" ]
|
27
main.py
27
main.py
@ -1,2 +1,29 @@
|
|||||||
# A simple script that creates a file of inputted size saved at the inputted destination.
|
# A simple script that creates a file of inputted size saved at the inputted destination.
|
||||||
# aimed at testing storage is functioning on Longhorn running in a kubernetes cluster.
|
# aimed at testing storage is functioning on Longhorn running in a kubernetes cluster.
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
# Get env vars:
|
||||||
|
print('Fetching configuration from environment')
|
||||||
|
size = os.getenv('STOR_SIZE') # In bytes (x1000)
|
||||||
|
path = os.getenv('STOR_PATH')
|
||||||
|
|
||||||
|
print('Path: '+ path + ', Size: ' + size + 'B')
|
||||||
|
|
||||||
|
def generate(number, path, size):
|
||||||
|
filepath = path + '/' + str(number) + 'stor.bin'
|
||||||
|
with open(filepath, mode='wb') as out:
|
||||||
|
out.write(os.urandom(int(size)))
|
||||||
|
|
||||||
|
print('File of ' + size + 'B created at ' + filepath)
|
||||||
|
pass
|
||||||
|
|
||||||
|
passes = 0
|
||||||
|
while passes < 1000:
|
||||||
|
generate(passes,path,size)
|
||||||
|
passes += 1
|
||||||
|
|
||||||
|
while True:
|
||||||
|
print("Program running...")
|
||||||
|
time.sleep(10) # Is this s or ms?
|
Loading…
Reference in New Issue
Block a user