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

Decouple DB and JSON conversions from protobuf strings #882

Merged
merged 3 commits into from
Jun 22, 2018

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented Jun 22, 2018

Follow-up on #856 and #881

Unit tests for Cassandra DB model conversion were defining test fixtures using constants from model. As a result of #856 some of the constants were changed, in particular the string representation of the ValueType field in KeyValue struct was changed to upper-case letters. As a result, the conversion to DB model was producing backwards incompatible string constants, without any unit tests failing.

This change removes model.ValueTypeFromString and model.SpanRefTypeFromString functions to avoid accidental reliance on protobuf-produced string constants in other parts of the code. The conversion in json and cassandra/dbmodel packages is changed to use explicit mapping between domain constants and respective constants in the other models. Unit tests are changed to use the exact expected strings to avoid potential future regressions.

Yuri Shkuro added 3 commits June 22, 2018 18:25
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
Signed-off-by: Yuri Shkuro <ys@uber.com>
@yurishkuro yurishkuro force-pushed the decouple-convrsions-from-protobuf-strings branch from ee0ac0a to 0d44733 Compare June 22, 2018 22:25
@codecov
Copy link

codecov bot commented Jun 22, 2018

Codecov Report

Merging #882 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #882   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         126    126           
  Lines        6067   6051   -16     
=====================================
- Hits         6067   6051   -16
Impacted Files Coverage Δ
model/spanref.go 100% <ø> (ø) ⬆️
model/keyvalue.go 100% <ø> (ø) ⬆️
...lugin/storage/cassandra/spanstore/dbmodel/model.go 100% <ø> (ø) ⬆️
model/converter/json/to_domain.go 100% <100%> (ø) ⬆️
...n/storage/cassandra/spanstore/dbmodel/converter.go 100% <100%> (ø) ⬆️

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 85f3df7...0d44733. Read the comment docs.

@yurishkuro yurishkuro merged commit 3a31eae into master Jun 22, 2018
@ghost ghost removed the review label Jun 22, 2018
@pavolloffay pavolloffay deleted the decouple-convrsions-from-protobuf-strings branch November 5, 2018 12:51
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