Commit ba2b7d3c authored by Eteri's avatar Eteri

clean up

parent 71b5141f
...@@ -28,7 +28,6 @@ home = $${:etc}/home ...@@ -28,7 +28,6 @@ home = $${:etc}/home
ssl = $${:etc}/ssl ssl = $${:etc}/ssl
working-dir = $${buildout:directory}/tmp/ working-dir = $${buildout:directory}/tmp/
[runTest-instance] [runTest-instance]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-test:output} url = ${template-test:output}
...@@ -90,7 +89,6 @@ context = ...@@ -90,7 +89,6 @@ context =
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
secure_access = http://$${caddy-configuration:local_ip}:4443} secure_access = http://$${caddy-configuration:local_ip}:4443}
[download-source] [download-source]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
...@@ -116,5 +114,4 @@ environment = ...@@ -116,5 +114,4 @@ environment =
GLOBAL_IPV6=$${slap-network-information:global-ipv6} GLOBAL_IPV6=$${slap-network-information:global-ipv6}
FLUENT_SERVICE = $${fluentd-service:path} FLUENT_SERVICE = $${fluentd-service:path}
SLAPOS_TEST_WORKING_DIR=$${directory:working-dir} SLAPOS_TEST_WORKING_DIR=$${directory:working-dir}
CADDY_DIR = $${directory:etc}/caddy_pidfile CADDY_DIR = $${directory:etc}/caddy_pidfile
DEBUG=1 \ No newline at end of file
\ No newline at end of file
...@@ -16,8 +16,6 @@ parts = ...@@ -16,8 +16,6 @@ parts =
instance-profile instance-profile
template-fluentdConfig template-fluentdConfig
[setup-develop-egg] [setup-develop-egg]
recipe = zc.recipe.egg:develop recipe = zc.recipe.egg:develop
...@@ -31,7 +29,6 @@ setup = ${slapos-repository:location}/software/erp5testnode/testsuite/fluentTest ...@@ -31,7 +29,6 @@ setup = ${slapos-repository:location}/software/erp5testnode/testsuite/fluentTest
egg = erp5.util[testnode] egg = erp5.util[testnode]
setup = ${erp5.util-repository:location} setup = ${erp5.util-repository:location}
[eggs] [eggs]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs =
...@@ -122,7 +119,7 @@ mode = 0644 ...@@ -122,7 +119,7 @@ mode = 0644
[template-caddy-fluentd] [template-caddy-fluentd]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-caddy-fluentd.cfg.in url = ${:_profile_base_location_}/instance-caddy-fluentd.cfg.in
md5sum = 22f725151611725fdca77e080b8d18e4 md5sum = ccfc6d0a4dfe0217cce5d369eea5cbd1
output = ${buildout:directory}/instance-caddy-fluentd.cfg.in output = ${buildout:directory}/instance-caddy-fluentd.cfg.in
mode = 0644 mode = 0644
...@@ -136,8 +133,4 @@ make-binary = cd ${:path}/caddy && ${:go} install -v ...@@ -136,8 +133,4 @@ make-binary = cd ${:path}/caddy && ${:go} install -v
environment = environment =
PATH=${pkgconfig:location}/bin:${gowork:golang}/bin:${buildout:bin-directory}:%(PATH)s PATH=${pkgconfig:location}/bin:${gowork:golang}/bin:${buildout:bin-directory}:%(PATH)s
GOPATH=${gowork:directory} GOPATH=${gowork:directory}
output = ${gowork:bin}/caddy 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 ...@@ -16,10 +16,7 @@ import utils
import threading import threading
test_msg = "dummyInputSimpleIngest" test_msg = "dummyInputSimpleIngest"
#url = "http://$${caddy-configuration:local_ip}:8443"
url = "http://" + os.environ.get('LOCAL_IPV4') + ":4443" url = "http://" + os.environ.get('LOCAL_IPV4') + ":4443"
#caddy_pidfile = "$${directory:etc}/caddy_pidfile"
caddy_pidfile = os.environ.get('CADDY_DIR') caddy_pidfile = os.environ.get('CADDY_DIR')
posted_data = None posted_data = None
all_data = [] all_data = []
...@@ -47,7 +44,6 @@ class TestServerHandler(BaseHTTPRequestHandler): ...@@ -47,7 +44,6 @@ class TestServerHandler(BaseHTTPRequestHandler):
self._set_headers() self._set_headers()
self.wfile.write("<html><body><h1>hi!</h1></body></html>") self.wfile.write("<html><body><h1>hi!</h1></body></html>")
def do_HEAD(self): def do_HEAD(self):
self._set_headers() self._set_headers()
...@@ -60,8 +56,7 @@ class TestServerHandler(BaseHTTPRequestHandler): ...@@ -60,8 +56,7 @@ class TestServerHandler(BaseHTTPRequestHandler):
global posted_data global posted_data
posted_data = post_data posted_data = post_data
print("post data from do_POST")
print(posted_data)
global all_data global all_data
all_data.append(post_data.split(" ")[1]) all_data.append(post_data.split(" ")[1])
...@@ -80,26 +75,17 @@ class TestIngestion(FluentdPluginTestCase): ...@@ -80,26 +75,17 @@ class TestIngestion(FluentdPluginTestCase):
time.sleep(10) time.sleep(10)
print("server start") print("server start")
@classmethod @classmethod
def stopServer(cls): def stopServer(cls):
cls.server.shutdown() cls.server.shutdown()
cls.server.server_close() cls.server.server_close()
print("serever shutdown") print("serever shutdown")
time.sleep(10) time.sleep(10)
# def setUp(self):
# self.startServer()
# def tearDown(self):
# #self.stopServer()
# time.sleep(10)
def test_1_get(self): def test_1_get(self):
self.startServer() self.startServer()
time.sleep(10) time.sleep(10)
print("start server")
print("############## TEST 1 ##############") print("############## TEST 1 ##############")
resp = requests.get(url) resp = requests.get(url)
...@@ -112,15 +98,13 @@ class TestIngestion(FluentdPluginTestCase): ...@@ -112,15 +98,13 @@ class TestIngestion(FluentdPluginTestCase):
print("############## TEST 2 ##############") print("############## TEST 2 ##############")
start_fluentd_cat(test_msg, "tag_test_2") start_fluentd_cat(test_msg, "tag_test_2")
time.sleep(10) time.sleep(10)
print("posted data from test 2")
print(posted_data)
if posted_data: if posted_data:
self.assertEqual(test_msg, posted_data.split(" ")[1]) self.assertEqual(test_msg, posted_data.split(" ")[1])
else: else:
self.assertEqual(test_msg, posted_data) self.assertEqual(test_msg, posted_data)
time.sleep(10) time.sleep(10)
def test_3_keepAlive_on(self): def test_3_keepAlive_on(self):
print("############## TEST 3 ##############") print("############## TEST 3 ##############")
s = requests.session() s = requests.session()
...@@ -168,17 +152,17 @@ class TestIngestion(FluentdPluginTestCase): ...@@ -168,17 +152,17 @@ class TestIngestion(FluentdPluginTestCase):
def test_6_check_diff_tags(self): def test_6_check_diff_tags(self):
print("############## TEST 6 ##############") print("############## TEST 6 ##############")
start_fluentd_cat("dummyInputTags_6_1", "test_Tag_6_1") start_fluentd_cat("dummyInputTags_6_1", "tag_Test_6_1")
time.sleep(2) time.sleep(10)
self.assertEqual("test_Tag_6_1", request_tag) 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) 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) time.sleep(2)
self.assertEqual("test_Tag_6_3", request_tag) self.assertEqual("tag_Test_6_3", request_tag)
self.stopServer() self.stopServer()
time.sleep(10) time.sleep(10)
...@@ -188,8 +172,6 @@ def start_fluentd_cat(test_msg, tag): ...@@ -188,8 +172,6 @@ def start_fluentd_cat(test_msg, tag):
os.environ["GEM_PATH"] = fluent_service + "/lib/ruby/gems/1.8/" os.environ["GEM_PATH"] = fluent_service + "/lib/ruby/gems/1.8/"
fluentd_cat_exec_comand = fluent_service + '/bin/fluent-cat --none ' + tag + " -p 5438 " fluentd_cat_exec_comand = fluent_service + '/bin/fluent-cat --none ' + tag + " -p 5438 "
os.system("echo + " + test_msg + " | " + fluentd_cat_exec_comand) os.system("echo + " + test_msg + " | " + fluentd_cat_exec_comand)
print("Fluent-cat path")
print(fluentd_cat_exec_comand)
def kill_caddy(caddy_pid): 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