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

service config version [T1031] #322

Merged
merged 41 commits into from
Mar 7, 2019
Merged

service config version [T1031] #322

merged 41 commits into from
Mar 7, 2019

Conversation

Lagovas
Copy link
Collaborator

@Lagovas Lagovas commented Mar 5, 2019

  • extend config generation and handle one parameter: folder where it should be generated
  • add check on CI that config files in configs/ are up to date. it check by generating fresh configs to temporary folder and comparing it to configs/* files
  • allow comparing versions by parts to provide a way to ignore patch part of version
  • moved tests db independent to another workflow general_validation where run .circleci/check_[gofmt|golint|gotest]
  • services check version from config that it equal with major + minor parts and ignore patch part of version
  • synchronized error messages for all cmd/* binaries for incorrect config version case

store diffs as artifact
Copy link
Contributor

@ilammy ilammy left a comment

Choose a reason for hiding this comment

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

LGTM in general, but I have some (dumb) questions.

cmd/utils.go Outdated Show resolved Hide resolved
configs/regenerate.sh Show resolved Hide resolved
tests/test.py Outdated Show resolved Hide resolved
tests/test.py Show resolved Hide resolved
@@ -43,17 +43,61 @@ const (
Less ComparisonStatus = iota - 1 // -1
Equal // 0
Greater // 1
InvalidFlags
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems out-of-place here. Isn't this an error which should be reported accordingly?

I'd expect the comparison flags to be inlined at every call site. Therefore using an incorrect set of flags is definitely a programmer error and we can panic if the flags are invalid.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's a bad pattern to decide what should do unknown program. To handle panics in golang programs programmer should to wrap this function which will defer function with `recover()`` call if he wants to handle an error in place where it has occurred

I added this flag for cases when wasn't used any flag (pass 0) or incorrect value. Function should compare two values and return any less/equal/greater. But in other cases with undefined (oh, maybe use undefined?) value used some value that will show it and allow to handle it.

Anyway programmer will test his code with comparisons and catch his mistakes. He can write if v1.CompareOnly(0, v2) <operator> <value where operator may be == or != (>, >=, <=, < is unexpected and not supported operators as any of other implementations of compare in golang/c/c++). If he expect that result == Equal or != Equal, he will take it anyway if pass incorrect flag : )

or we need +1 opinion how will be better in this case )

@@ -1,5 +1,31 @@
version: 2
jobs:
general_validation:
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is very good move!!

@@ -1,4 +1,3 @@
schemas:
Copy link
Collaborator

Choose a reason for hiding this comment

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

why this line is removed? is it a bug in yaml generator and on first line there should be a version num?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Lagovas I'm really concerned about this one

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it's a mistake. nice catch. maybe removed locally and added via git add by mistake

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, thank you!

@vixentael vixentael self-requested a review March 7, 2019 14:37
Copy link
Collaborator

@vixentael vixentael left a comment

Choose a reason for hiding this comment

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

this is massive! 😎

@Lagovas Lagovas merged commit 46c9a06 into cossacklabs:master Mar 7, 2019
@Lagovas Lagovas deleted the lagovas/T1031-service-config-version branch March 11, 2019 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants