Skip to content
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

Merged
merged 1 commit into from
Aug 11, 2017
Merged

Added tests. #13

merged 1 commit into from
Aug 11, 2017

Conversation

cheshir
Copy link
Owner

@cheshir cheshir commented Aug 10, 2017

No description provided.

@cheshir
Copy link
Owner Author

cheshir commented Aug 10, 2017

@ynotLeft check it please.

@codecov
Copy link

codecov bot commented Aug 10, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@490b064). Click here to learn what that means.
The diff coverage is 62.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #13   +/-   ##
=========================================
  Coverage          ?   70.05%           
=========================================
  Files             ?        6           
  Lines             ?      354           
  Branches          ?        0           
=========================================
  Hits              ?      248           
  Misses            ?       84           
  Partials          ?       22
Impacted Files Coverage Δ
config.go 100% <100%> (ø)
mq.go 52.1% <57.14%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 490b064...7891d3b. Read the comment docs.

@cheshir cheshir mentioned this pull request Aug 10, 2017
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.

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:

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:

Copy link

@ynotLeft ynotLeft Aug 11, 2017

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:,
тоже правильно

}

if expectedProducer != actualProducer {
t.Errorf("Obtain producer from registry that is different from expected producer")

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?

Copy link
Owner Author

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"?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are not equal тогда

producer, ok := registry.Get("name")

if ok || producer != nil {
t.Error("Registry found a not registered producer")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-registered producer

}

if expectedConsumer != actualConsumer {
t.Errorf("Obtain consumer from registry that is different from expected consumer")

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?

consumer, ok := registry.Get("name")

if ok || consumer != nil {
t.Error("Registry found a not registered consumer")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-registered

@cheshir cheshir force-pushed the add_tests branch 2 times, most recently from 17c58d0 to 9343f46 Compare August 11, 2017 11:37
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.

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.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что тут имелось ввиду?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Должна вернуться ошибка если ты подключаешься к остановленному брокеру.

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?

Copy link
Owner Author

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)

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.")

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.

Copy link
Owner Author

@cheshir cheshir Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to to? Может or to?

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")

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)

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")

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)

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)

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)

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")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут ошибка в том, что мы не получили ошибку?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, все верно.

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)

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)

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)

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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a new

@cheshir cheshir merged commit de6be23 into master Aug 11, 2017
@cheshir cheshir deleted the add_tests branch August 11, 2017 12:37
@cheshir
Copy link
Owner Author

cheshir commented Aug 11, 2017

@ynotLeft great work again. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants