-
Notifications
You must be signed in to change notification settings - Fork 18
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. #13
Added tests. #13
Conversation
@ynotLeft check it please. |
Codecov Report
@@ Coverage Diff @@
## master #13 +/- ##
=========================================
Coverage ? 70.05%
=========================================
Files ? 6
Lines ? 354
Branches ? 0
=========================================
Hits ? 248
Misses ? 84
Partials ? 22
Continue to review full report at Codecov.
|
README.md
Outdated
# Tests | ||
|
||
There are some cases that can be tested only with real broker | ||
and some cases that can be tested only with mocked broker. |
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.
there are some cases that can only be tested with real broker...
README.md
Outdated
There are some cases that can be tested only with real broker | ||
and some cases that can be tested only with mocked broker. | ||
|
||
If you have ability run tests with real broker run tests with: |
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.
If you are able to run tests with a real broker run them with:
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.
Если хочешь как у тебя, то
If you have an ability to run tests with a real broker run then with:,
тоже правильно
registries_test.go
Outdated
} | ||
|
||
if expectedProducer != actualProducer { | ||
t.Errorf("Obtain producer from registry that is different from expected producer") |
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.
мб просто
Obtained unexpected producer from registry?
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.
What do u think about: "Expected and actual consumer is not equal"?
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.
are not equal тогда
registries_test.go
Outdated
producer, ok := registry.Get("name") | ||
|
||
if ok || producer != nil { | ||
t.Error("Registry found a not registered producer") |
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.
non-registered producer
registries_test.go
Outdated
} | ||
|
||
if expectedConsumer != actualConsumer { | ||
t.Errorf("Obtain consumer from registry that is different from expected consumer") |
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.
Obtained unexpected consumer from registry?
registries_test.go
Outdated
consumer, ok := registry.Get("name") | ||
|
||
if ok || consumer != nil { | ||
t.Error("Registry found a not registered consumer") |
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.
non-registered
17c58d0
to
9343f46
Compare
mq_test.go
Outdated
// +build !race | ||
|
||
// There is some issue with wabbit that causes a data races | ||
// so we mute race detector until issue wont be fixed. |
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.
until issue is fixed
}) | ||
|
||
if err == nil { | ||
t.Error("Mq must not successfully connect to the broker when it's stopped.") |
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.
Что тут имелось ввиду?
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.
Должна вернуться ошибка если ты подключаешься к остановленному брокеру.
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.
Получилось Mq не должен успешно подключаться к брокеру когда тот остановился.
может написать:
Error occurred while trying to connect to the stopped broker?
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.
Получилось Mq не должен успешно подключаться к брокеру когда тот остановился.
Все правильно получилось. 😀
Ожидалось, что вернется ошибка, а ее нет. Надо бить тревогу.
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new instance
mq_test.go
Outdated
) | ||
|
||
func init() { | ||
flag.BoolVar(&brokerIsMocked, "mock-broker", true, "Whether to mock broker or use real one. 0: use real broker. 1: use mocked broker.") |
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.
Whether to mock broker to to use a real one.
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.
to to
? Может or to
?
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.
yep
mq_test.go
Outdated
waitForMessageDelivery() | ||
|
||
if atomic.LoadInt32(&messageWasRead) != 1 { | ||
t.Error("Consumer have not read the message") |
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.
did not read the message
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new instance
mq_test.go
Outdated
waitForMessageDelivery() | ||
|
||
if atomic.LoadInt32(&messageWasRead) != 1 { | ||
t.Error("Consumer have not read the message") |
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.
did not read
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new instance
mq_test.go
Outdated
|
||
_, err = mq.GetConsumer(defaultConsumerName) | ||
if err != nil { | ||
t.Error("Failed to get consumer: ", err) |
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.
a consumer
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new instance
|
||
_, err = mq.GetConsumer("nonexistent_consumer") | ||
if err == nil { | ||
t.Error("No error got during getting non existent consumer") |
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.
Тут ошибка в том, что мы не получили ошибку?
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.
Да, все верно.
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.
No error got during getting non existent consumer
Did not catch (или get) an error during the retrieval of non-existent consumer.
ниже были еще подобные конструкции
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new
mq_test.go
Outdated
|
||
_, err = mq.GetProducer(defaultProducerName) | ||
if err != nil { | ||
t.Error("Failed to get producer: ", err) |
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.
a producer
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new instance
mq_test.go
Outdated
}) | ||
|
||
if err != nil { | ||
t.Error("Can't create new instance of mq: ", err) |
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.
a new
@ynotLeft great work again. Thank you! |
No description provided.