Skip to content

Commit

Permalink
update tests to be compatiable with streaming operations without events
Browse files Browse the repository at this point in the history
  • Loading branch information
jasdel committed Oct 10, 2019
1 parent 7746eb8 commit dddcc33
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 64 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions private/model/api/eventstream.go
Expand Up @@ -208,7 +208,7 @@ func setupEventStream(topShape *Shape) *EventStream {
eventRef.Shape.EventFor = append(eventRef.Shape.EventFor, eventStream)

// Exceptions and events are two different lists to allow the SDK
// to easly generate code with the two handled differently.
// to easily generate code with the two handled differently.
event := &Event{
Name: eventRefName,
Shape: eventRef.Shape,
Expand Down Expand Up @@ -974,14 +974,16 @@ func (c *loopReader) Read(p []byte) (int, error) {
t.Fatalf("expect no error got, %v", err)
}
// Assert calling Err before close does not close the stream.
resp.{{ $esMemberName }}.Err()
select {
case _, ok := <-resp.{{ $esMemberName }}.Events():
if !ok {
t.Fatalf("expect stream not to be closed, but was")
if len(eventMsgs) != 0 {
// Assert calling Err before close does not close the stream.
resp.{{ $esMemberName }}.Err()
select {
case _, ok := <-resp.{{ $esMemberName }}.Events():
if !ok {
t.Fatalf("expect stream not to be closed, but was")
}
default:
}
default:
}
resp.{{ $esMemberName }}.Close()
Expand Down
16 changes: 9 additions & 7 deletions service/kinesis/eventstream_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions service/s3/eventstream_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dddcc33

Please sign in to comment.