Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matevz Golob
wendelin
Commits
8035615a
Commit
8035615a
authored
Sep 11, 2017
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: tests using new model.
parent
d416f797
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
34 deletions
+24
-34
bt5/erp5_wendelin/PathTemplateItem/portal_callables/DataIngestionLine_writeFluentdIngestionToDataStream.py
...es/DataIngestionLine_writeFluentdIngestionToDataStream.py
+1
-0
bt5/erp5_wendelin/PathTemplateItem/portal_callables/DataIngestionLine_writeFluentdIngestionToDataStream.xml
...s/DataIngestionLine_writeFluentdIngestionToDataStream.xml
+3
-4
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
...tTemplateItem/portal_components/test.erp5.testWendelin.py
+20
-30
No files found.
bt5/erp5_wendelin/PathTemplateItem/portal_callables/DataIngestionLine_writeFluentdIngestionToDataStream.py
View file @
8035615a
data_stream
=
out_data_stream
[
'Data Stream'
]
data_stream
.
appendData
(
''
.
join
([
c
[
1
]
for
c
in
context
.
unpack
(
data_chunk
)]))
data_stream
.
appendData
(
''
.
join
([
c
[
1
]
for
c
in
context
.
unpack
(
data_chunk
)]))
bt5/erp5_wendelin/PathTemplateItem/portal_callables/DataIngestionLine_writeFluentdIngestionToDataStream.xml
View file @
8035615a
...
@@ -77,13 +77,12 @@
...
@@ -77,13 +77,12 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
data_chunk=None, data_stream=None
</string>
</value>
<value>
<string>
data_chunk=None, data_stream=None
, bucket_reference=None, out_data_stream=None
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
<value>
<value>
<string>
This script is used with default simple Wendelin model defined in erp5_wendelin_data.\n
<none/>
For other models it will need adjustments.
</string>
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
description
</string>
</key>
<key>
<string>
description
</string>
</key>
...
...
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
View file @
8035615a
...
@@ -28,8 +28,8 @@
...
@@ -28,8 +28,8 @@
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
wendelin.bigarray.array_zodb
import
ZBigArray
from
wendelin.bigarray.array_zodb
import
ZBigArray
from
DateTime
import
DateTime
#
from DateTime import DateTime
from
zExceptions
import
NotFound
#
from zExceptions import NotFound
import
msgpack
import
msgpack
import
numpy
as
np
import
numpy
as
np
import
string
import
string
...
@@ -52,28 +52,6 @@ class Test(ERP5TypeTestCase):
...
@@ -52,28 +52,6 @@ class Test(ERP5TypeTestCase):
def
getTitle
(
self
):
def
getTitle
(
self
):
return
"Wendelin Test"
return
"Wendelin Test"
def
afterSetUp
(
self
):
"""
This is ran before anything, used to set the environment
"""
# here, you can create the categories and objects your test will depend on
pass
def
stepSetupIngestion
(
self
,
reference
):
"""
Generic step.
"""
ingestion_policy
,
data_supply
,
data_stream
,
data_array
=
\
self
.
portal
.
portal_ingestion_policies
.
IngestionPolicyTool_addIngestionPolicy
(
\
reference
=
reference
,
\
batch_mode
=
1
)
# to avoid random test failures due to test execution we make start date one day before
data_supply
.
setStartDate
(
DateTime
()
-
1
)
self
.
tic
()
return
ingestion_policy
,
data_supply
,
data_stream
,
data_array
def
test_0_import
(
self
):
def
test_0_import
(
self
):
"""
"""
Test we can import certain libraries but still failure to do so should be a
Test we can import certain libraries but still failure to do so should be a
...
@@ -92,7 +70,9 @@ class Test(ERP5TypeTestCase):
...
@@ -92,7 +70,9 @@ class Test(ERP5TypeTestCase):
portal
=
self
.
portal
portal
=
self
.
portal
request
=
portal
.
REQUEST
request
=
portal
.
REQUEST
reference
=
getRandomString
()
ingestion_policy
=
portal
.
restrictedTraverse
(
"portal_ingestion_policies/wendelin_1"
)
data_supply
=
portal
.
restrictedTraverse
(
"data_supply_module/wendelin_1"
)
reference
=
'wendelin-default-ingestion'
number_string_list
=
[]
number_string_list
=
[]
for
my_list
in
list
(
chunks
(
range
(
0
,
100001
),
10
)):
for
my_list
in
list
(
chunks
(
range
(
0
,
100001
),
10
)):
number_string_list
.
append
(
','
.
join
([
str
(
x
)
for
x
in
my_list
]))
number_string_list
.
append
(
','
.
join
([
str
(
x
)
for
x
in
my_list
]))
...
@@ -100,19 +80,27 @@ class Test(ERP5TypeTestCase):
...
@@ -100,19 +80,27 @@ class Test(ERP5TypeTestCase):
# make sure real_data tail is also a full line
# make sure real_data tail is also a full line
real_data
+=
'
\
n
'
real_data
+=
'
\
n
'
ingestion_policy
,
_
,
data_stream
,
data_array
=
\
self
.
stepSetupIngestion
(
reference
)
# simulate fluentd by setting proper values in REQUEST
# simulate fluentd by setting proper values in REQUEST
request
.
method
=
'POST'
request
.
method
=
'POST'
data_chunk
=
msgpack
.
packb
([
0
,
real_data
],
use_bin_type
=
True
)
data_chunk
=
msgpack
.
packb
([
0
,
real_data
],
use_bin_type
=
True
)
request
.
set
(
'reference'
,
reference
)
request
.
set
(
'reference'
,
reference
)
request
.
set
(
'data_chunk'
,
data_chunk
)
request
.
set
(
'data_chunk'
,
data_chunk
)
ingestion_policy
.
ingest
()
ingestion_policy
.
ingest
()
self
.
tic
()
# get related Data ingestion
data_ingestion
=
data_supply
.
Base_getRelatedObjectList
(
portal_type
=
'Data Ingestion'
)[
0
]
self
.
assertNotEqual
(
None
,
data_ingestion
)
data_ingestion_line
=
[
x
for
x
in
data_ingestion
.
objectValues
()
if
x
.
getReference
()
==
'out_data_stream'
][
0
]
data_stream
=
data_ingestion_line
.
getAggregateValue
()
self
.
assertEqual
(
'Data Stream'
,
data_stream
.
getPortalType
())
data_stream_data
=
data_stream
.
getData
()
data_stream_data
=
data_stream
.
getData
()
self
.
assertEqual
(
real_data
,
data_stream_data
)
self
.
assertEqual
(
real_data
,
data_stream_data
)
return
"""
# try sample transformation
# try sample transformation
data_stream.DataStream_transform(
\
data_stream.DataStream_transform(
\
chunk_length = 10450,
\
chunk_length = 10450,
\
...
@@ -120,7 +108,7 @@ class Test(ERP5TypeTestCase):
...
@@ -120,7 +108,7 @@ class Test(ERP5TypeTestCase):
data_array_reference = reference)
data_array_reference = reference)
self.tic()
self.tic()
# test that extracted array contains same values as input CSV
# test that extracted array contains same values as input CSV
zarray = data_array.getArray()
zarray = data_array.getArray()
self.assertEqual(np.average(zarray), np.average(np.arange(100001)))
self.assertEqual(np.average(zarray), np.average(np.arange(100001)))
...
@@ -129,6 +117,8 @@ class Test(ERP5TypeTestCase):
...
@@ -129,6 +117,8 @@ class Test(ERP5TypeTestCase):
# test ingesting with bad reference and raise of NotFound
# test ingesting with bad reference and raise of NotFound
request.set('reference', reference + 'not_existing')
request.set('reference', reference + 'not_existing')
self.assertRaises(NotFound, ingestion_policy.ingest)
self.assertRaises(NotFound, ingestion_policy.ingest)
"""
def
test_01_1_IngestionTail
(
self
):
def
test_01_1_IngestionTail
(
self
):
...
...
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