Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
slapos
Commits
ba2b7d3c
Commit
ba2b7d3c
authored
May 14, 2018
by
Eteri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up
parent
71b5141f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
40 deletions
+69
-40
software/erp5testnode/testsuite/fluentTest/instance-caddy-fluentd.cfg.in
...stnode/testsuite/fluentTest/instance-caddy-fluentd.cfg.in
+1
-4
software/erp5testnode/testsuite/fluentTest/software.cfg
software/erp5testnode/testsuite/fluentTest/software.cfg
+2
-9
software/erp5testnode/testsuite/fluentTest/tests/my_server.py
...ware/erp5testnode/testsuite/fluentTest/tests/my_server.py
+57
-0
software/erp5testnode/testsuite/fluentTest/tests/test.py
software/erp5testnode/testsuite/fluentTest/tests/test.py
+9
-27
No files found.
software/erp5testnode/testsuite/fluentTest/instance-caddy-fluentd.cfg.in
View file @
ba2b7d3c
...
...
@@ -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
software/erp5testnode/testsuite/fluentTest/software.cfg
View file @
ba2b7d3c
...
...
@@ -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
software/erp5testnode/testsuite/fluentTest/tests/my_server.py
0 → 100644
View file @
ba2b7d3c
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
software/erp5testnode/testsuite/fluentTest/tests/test.py
View file @
ba2b7d3c
...
...
@@ -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"
,
"t
est_Tag
_6_1"
)
time
.
sleep
(
2
)
self
.
assertEqual
(
"t
est_Tag
_6_1"
,
request_tag
)
start_fluentd_cat
(
"dummyInputTags_6_1"
,
"t
ag_Test
_6_1"
)
time
.
sleep
(
10
)
self
.
assertEqual
(
"t
ag_Test
_6_1"
,
request_tag
)
start_fluentd_cat
(
"dummyInputTags_6_2"
,
"t
est_Tag
_6_2"
)
start_fluentd_cat
(
"dummyInputTags_6_2"
,
"t
ag_Test
_6_2"
)
time
.
sleep
(
2
)
self
.
assertEqual
(
"t
est_Tag
_6_2"
,
request_tag
)
self
.
assertEqual
(
"t
ag_Test
_6_2"
,
request_tag
)
start_fluentd_cat
(
"dummyInputTags_6_3"
,
"t
est_Tag
_6_3"
)
start_fluentd_cat
(
"dummyInputTags_6_3"
,
"t
ag_Test
_6_3"
)
time
.
sleep
(
2
)
self
.
assertEqual
(
"t
est_Tag
_6_3"
,
request_tag
)
self
.
assertEqual
(
"t
ag_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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment