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
fix: skip comments when loading test relationships #335
fix: skip comments when loading test relationships #335
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Yeah, that's correct :) |
I have read the CLA Document and I hereby sign the CLA |
@@ -94,7 +94,7 @@ func PopulateFromFiles(ds datastore.Datastore, filePaths []string) (*FullyParsed | |||
lines := strings.Split(relationships, "\n") | |||
for index, line := range lines { | |||
trimmed := strings.TrimSpace(line) | |||
if len(trimmed) == 0 { | |||
if len(trimmed) == 0 || strings.HasPrefix(trimmed, "//") { |
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.
Mind adding a test into fileformat_test.go
?
When writing the tests, a few thoughts came to me:
|
We actually do something similar for the consistency tests: https://github.com/authzed/spicedb/blob/main/internal/services/consistency_test.go (it loads from a directory called
MemDB is the correct datastore to use. See https://github.com/authzed/spicedb/blob/main/internal/services/consistency_test.go#L64 for an example |
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.
LGTM
Signed-off-by: Bryan Huhta <bryanhuhta@github.com>
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.
LGTM
Fixes #329
From a brief test in the playground, comments in the Test Relationships are only of the format
// my comment
and not/** my comment */
. This may need to be fact check though 😁