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

Hw12 13 14 15 calendar #14

Merged
merged 8 commits into from
Sep 16, 2020
Merged

Hw12 13 14 15 calendar #14

merged 8 commits into from
Sep 16, 2020

Conversation

dmitryt
Copy link
Owner

@dmitryt dmitryt commented Sep 13, 2020

Домашнее задание №15 «Докеризация и интеграционное тестирование Календаря»

Критерии оценки

  • Проект полностью запускается и останавливается с помощью make up / make down - 3 балла
  • Интеграционные тесты запускаются с помощью make bdd. Команда возвращает верный код ответа - 1 балл

Интеграционные тесты покрывают бизнес сценарии:

  • добавление события и обработка бизнес ошибок - 2 балла
  • получение листинга событий на день/неделю/месяц - 2 балла
  • отправка уведомлений - 2 балла

Зачёт от 7 баллов

@@ -0,0 +1,85 @@
version: "2.4"
Copy link
Owner Author

Choose a reason for hiding this comment

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

Used this version of docker-compose to have an ability to use healthcheck together with depends_on

"github.com/heetch/confita"
"github.com/heetch/confita/backend/env"
"github.com/heetch/confita/backend/file"
"github.com/ilyakaznacheev/cleanenv"
Copy link
Owner Author

Choose a reason for hiding this comment

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

I had to migrate to this package, because of problems with confita heetch/confita#77

@@ -35,10 +35,11 @@ func ConvertTimeToTimestamp(ntime sql.NullTime) (result *timestamp.Timestamp, er
// Didn't want to use reflection.
func ConvertEventToProto(evt repository.Event) (*Event, error) {
result := &Event{
ID: evt.ID,
UserID: evt.UserID,
ID: int32(evt.ID),
Copy link
Owner Author

Choose a reason for hiding this comment

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

protocolbuffers/protobuf#2679
strange "feature", so need to move to int/int32

Copy link
Collaborator

@Antonboom Antonboom left a comment

Choose a reason for hiding this comment

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

Здравствуйте!

Хорошая работа, ginkgo - огонь.
Принято
10 / 10

)

var (
now = time.Now()
Copy link
Collaborator

Choose a reason for hiding this comment

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

такое бывает опасно при тестах, которые могут идти часами, параллельно и афектить друг друга

бывают очень сложноотловимые баги :( которые лечатся, конечно, переносом этого выражения в более локальную область видимости

return
func NewCalendar(fpath string) (*Calendar, error) {
var cfg Calendar
return &cfg, readConfig(fpath, &cfg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

красивый приём 👍

только жалко, что приходится тогда возвращать указатель, что в данном случае выглядит сомнительно

}

func (r *MemoryRepo) GetUser(id int64) (User, error) {
r.mx.Lock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

RLock?

@dmitryt dmitryt merged commit 5ca8860 into master Sep 16, 2020
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