Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
Operations
Operations
Metrics
Environments
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
cpp-libs
Actor Framework
Commits
84361ff7
Commit
84361ff7
authored
Feb 12, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-implement broken pipeline unit test
parent
03002950
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
1 deletion
+29
-1
libcaf_core/test/local_streaming.cpp
libcaf_core/test/local_streaming.cpp
+29
-1
No files found.
libcaf_core/test/local_streaming.cpp
View file @
84361ff7
...
...
@@ -80,7 +80,7 @@ const char* sum_up_state::name = "sum_up";
behavior
sum_up
(
stateful_actor
<
sum_up_state
>*
self
)
{
return
{
[
=
](
stream
<
int
>&
in
,
string
&
fname
)
{
[
=
](
stream
<
int
>&
in
,
const
string
&
fname
)
{
CAF_CHECK_EQUAL
(
fname
,
"numbers.txt"
);
return
self
->
make_sink
(
// input stream
...
...
@@ -102,6 +102,20 @@ behavior sum_up(stateful_actor<sum_up_state>* self) {
};
}
struct
broken_sink_state
{
static
const
char
*
name
;
};
const
char
*
broken_sink_state
::
name
=
"broken_sink"
;
behavior
broken_sink
(
stateful_actor
<
broken_sink_state
>*
)
{
return
{
[
=
](
stream
<
int
>&
,
const
std
::
string
&
)
{
// nop
}
};
}
struct
fixture
:
test_coordinator_fixture
<>
{
};
...
...
@@ -172,4 +186,18 @@ CAF_TEST(depth_2_pipeline_500_items) {
CAF_CHECK_EQUAL
(
fail_state
(
src
),
exit_reason
::
normal
);
}
CAF_TEST
(
broken_pipeline
)
{
CAF_MESSAGE
(
"streams must abort if a stage fails to initialize its state"
);
auto
src
=
sys
.
spawn
(
file_reader
,
50
);
auto
snk
=
sys
.
spawn
(
broken_sink
);
auto
pipeline
=
snk
*
src
;
sched
.
run
();
CAF_MESSAGE
(
"initiate stream handshake"
);
self
->
send
(
pipeline
,
"test.txt"
);
expect
((
std
::
string
),
from
(
self
).
to
(
src
).
with
(
"test.txt"
));
expect
((
open_stream_msg
),
from
(
self
).
to
(
snk
));
expect
((
upstream_msg
::
forced_drop
),
from
(
snk
).
to
(
src
));
expect
((
error
),
from
(
snk
).
to
(
self
).
with
(
sec
::
stream_init_failed
));
}
CAF_TEST_FIXTURE_SCOPE_END
()
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