Commit ba2b7d3c authored by Eteri's avatar Eteri

clean up

parent 71b5141f
......@@ -28,7 +28,6 @@ home = $${:etc}/home
ssl = $${:etc}/ssl
working-dir = $${buildout:directory}/tmp/
[runTest-instance]
recipe = slapos.recipe.template
url = ${template-test:output}
......@@ -90,7 +89,6 @@ context =
recipe = slapos.cookbook:publish
secure_access = http://$${caddy-configuration:local_ip}:4443}
[download-source]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
......@@ -117,4 +115,3 @@ environment =
FLUENT_SERVICE = $${fluentd-service:path}
SLAPOS_TEST_WORKING_DIR=$${directory:working-dir}
CADDY_DIR = $${directory:etc}/caddy_pidfile
\ No newline at end of file
DEBUG=1
\ No newline at end of file
......@@ -16,8 +16,6 @@ parts =
instance-profile
template-fluentdConfig
[setup-develop-egg]
recipe = zc.recipe.egg:develop
......@@ -31,7 +29,6 @@ setup = ${slapos-repository:location}/software/erp5testnode/testsuite/fluentTest
egg = erp5.util[testnode]
setup = ${erp5.util-repository:location}
[eggs]
recipe = zc.recipe.egg
eggs =
......@@ -122,7 +119,7 @@ mode = 0644
[template-caddy-fluentd]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-caddy-fluentd.cfg.in
md5sum = 22f725151611725fdca77e080b8d18e4
md5sum = ccfc6d0a4dfe0217cce5d369eea5cbd1
output = ${buildout:directory}/instance-caddy-fluentd.cfg.in
mode = 0644
......@@ -137,7 +134,3 @@ environment =
PATH=${pkgconfig:location}/bin:${gowork:golang}/bin:${buildout:bin-directory}:%(PATH)s
GOPATH=${gowork:directory}
output = ${gowork:bin}/caddy
\ No newline at end of file
#versions]
#slapos.recipe.template = 4.3
#erp5.util = 0.4.50
\ No newline at end of file
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import SocketServer
import time
import threading
import os
class TestServerHandler(BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
self._set_headers()
self.wfile.write("<html><body><h1>hi!</h1></body></html>")
def do_HEAD(self):
self._set_headers()
def do_POST(self):
content_length = int(self.headers['Content-Length']) # <--- Gets the size of data
post_data = self.rfile.read(content_length) # <--- Gets the data itself
self._set_headers()
self.wfile.write(post_data)
global posted_data
posted_data = post_data
print("post data from do_POST")
print(posted_data)
# global all_data
# all_data.append(post_data.split(" ")[1])
# global request_tag
# request_tag = find_tag(self.requestline,"=", " ")
def run():
port=9443
#server_address = ('0.0.0.0', port)
server_address = ("10.0.46.242", port)
server = HTTPServer(server_address, TestServerHandler)
thread = threading.Thread(target=server.serve_forever)
thread.start()
print("start server")
time.sleep(60)
server.shutdown()
server.server_close()
print("stop server")
if __name__ == "__main__":
run()
\ No newline at end of file
......@@ -16,10 +16,7 @@ import utils
import threading
test_msg = "dummyInputSimpleIngest"
#url = "http://$${caddy-configuration:local_ip}:8443"
url = "http://" + os.environ.get('LOCAL_IPV4') + ":4443"
#caddy_pidfile = "$${directory:etc}/caddy_pidfile"
caddy_pidfile = os.environ.get('CADDY_DIR')
posted_data = None
all_data = []
......@@ -47,7 +44,6 @@ class TestServerHandler(BaseHTTPRequestHandler):
self._set_headers()
self.wfile.write("<html><body><h1>hi!</h1></body></html>")
def do_HEAD(self):
self._set_headers()
......@@ -60,8 +56,7 @@ class TestServerHandler(BaseHTTPRequestHandler):
global posted_data
posted_data = post_data
print("post data from do_POST")
print(posted_data)
global all_data
all_data.append(post_data.split(" ")[1])
......@@ -80,7 +75,6 @@ class TestIngestion(FluentdPluginTestCase):
time.sleep(10)
print("server start")
@classmethod
def stopServer(cls):
cls.server.shutdown()
......@@ -88,18 +82,10 @@ class TestIngestion(FluentdPluginTestCase):
print("serever shutdown")
time.sleep(10)
# def setUp(self):
# self.startServer()
# def tearDown(self):
# #self.stopServer()
# time.sleep(10)
def test_1_get(self):
self.startServer()
time.sleep(10)
print("start server")
print("############## TEST 1 ##############")
resp = requests.get(url)
......@@ -112,15 +98,13 @@ class TestIngestion(FluentdPluginTestCase):
print("############## TEST 2 ##############")
start_fluentd_cat(test_msg, "tag_test_2")
time.sleep(10)
print("posted data from test 2")
print(posted_data)
if posted_data:
self.assertEqual(test_msg, posted_data.split(" ")[1])
else:
self.assertEqual(test_msg, posted_data)
time.sleep(10)
def test_3_keepAlive_on(self):
print("############## TEST 3 ##############")
s = requests.session()
......@@ -168,17 +152,17 @@ class TestIngestion(FluentdPluginTestCase):
def test_6_check_diff_tags(self):
print("############## TEST 6 ##############")
start_fluentd_cat("dummyInputTags_6_1", "test_Tag_6_1")
time.sleep(2)
self.assertEqual("test_Tag_6_1", request_tag)
start_fluentd_cat("dummyInputTags_6_1", "tag_Test_6_1")
time.sleep(10)
self.assertEqual("tag_Test_6_1", request_tag)
start_fluentd_cat("dummyInputTags_6_2", "test_Tag_6_2")
start_fluentd_cat("dummyInputTags_6_2", "tag_Test_6_2")
time.sleep(2)
self.assertEqual("test_Tag_6_2", request_tag)
self.assertEqual("tag_Test_6_2", request_tag)
start_fluentd_cat("dummyInputTags_6_3", "test_Tag_6_3")
start_fluentd_cat("dummyInputTags_6_3", "tag_Test_6_3")
time.sleep(2)
self.assertEqual("test_Tag_6_3", request_tag)
self.assertEqual("tag_Test_6_3", request_tag)
self.stopServer()
time.sleep(10)
......@@ -188,8 +172,6 @@ def start_fluentd_cat(test_msg, tag):
os.environ["GEM_PATH"] = fluent_service + "/lib/ruby/gems/1.8/"
fluentd_cat_exec_comand = fluent_service + '/bin/fluent-cat --none ' + tag + " -p 5438 "
os.system("echo + " + test_msg + " | " + fluentd_cat_exec_comand)
print("Fluent-cat path")
print(fluentd_cat_exec_comand)
def kill_caddy(caddy_pid):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment