-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added tests + automatic test/coverage in travis + docs/readme #16
Merged
Merged
Changes from 29 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
5d33a50
added first test
fgschwan c6c3dfa
added vendor files for base test dependencies
fgschwan ef24f4e
added gobgp impl test
fgschwan 0d1db2d
Merge branch 'tests'
fgschwan c29a83b
Remove duplicated package under glide.yaml
403aee2
extended test to get better coverage
fgschwan f9108ca
added test and coverage commands to makefile
fgschwan 4f9e46b
Merge remote-tracking branch 'origin/master'
fgschwan 376d4ba
added runnning tests and test coverage for travis
fgschwan e62c423
added test coverage to readme
fgschwan 9882a47
fixed checkstyle for tests
fgschwan f0ce5e6
Merge pull request #15 from cgasparini/travis
jozef-slezak 478c6d6
disabled gotypex from checkstyle due to warnings that shouldn't be th…
fgschwan 5d9de6e
added documentation for tests methods
fgschwan 1ec5459
changed testify/assert for gomega in tests
fgschwan 36bbee0
changed testify/assert for gomega in glide files
fgschwan 8a753f7
fixed glide files
fgschwan 36cb7f2
changed testify/assert for gomega in vendor
fgschwan daed210
Merge branch 'test'
fgschwan cc8a744
docker folder refactoring
fgschwan ebefd20
removed not used gobgp configs
fgschwan 3a7699d
removed sudo usage just like it is in other scripts
fgschwan 3534804
made test run look more pretty in console
fgschwan 671a8e4
added quickstart to root readme
fgschwan f19f05f
simplified removing of docker container
fgschwan 1d8eec9
updated example readme for docker changes
fgschwan 4f9110a
fixed example readme by trying the example step-by-step
fgschwan baadc6f
added missing readme files
fgschwan 907e75b
added aggregation plugin idea into root readme
fgschwan 1d8881c
removed global variable
fgschwan 879f1f9
added note about creating route reflector in test
fgschwan b442d41
refactored gobgpplugin test to BDD's given/when/then idiom
fgschwan 3a4015b
fixed testing variable forwarding
fgschwan 1701a77
changed also bgp_api_test to BDD's given/when/test idiom
fgschwan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright (c) 2017 Pantheon technologies s.r.o. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at: | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package bgp | ||
|
||
import ( | ||
"github.com/ligato/cn-infra/logging/logrus" | ||
. "github.com/onsi/gomega" | ||
"net" | ||
"reflect" | ||
"testing" | ||
) | ||
|
||
// TestToChan tests ability of ToChan(...) function to create wrapping function that wraps given channel and forwards | ||
// all ReachableIPRoute data (given to the wrapping function by parameter) to the channel inside. | ||
// Test doesn't check logging capabilities of wrapping function. | ||
func TestToChan(t *testing.T) { | ||
// prepare of tested instances/helper instances | ||
RegisterTestingT(t) | ||
channel := make(chan ReachableIPRoute, 1) | ||
wrappingFunc := ToChan(channel, logrus.DefaultLogger()) | ||
|
||
// testing ToChan's returned function | ||
Expect(channel).To(BeEmpty()) | ||
sent := ReachableIPRoute{As: 1, Prefix: "1.2.3.4/32", Nexthop: net.IPv4(192, 168, 1, 1)} | ||
wrappingFunc(&sent) | ||
Expect(channel).ToNot(BeEmpty()) | ||
received := <-channel | ||
reflect.DeepEqual(sent, received) | ||
Expect(channel).To(BeEmpty()) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain in comment what is the intent of this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added