-
Notifications
You must be signed in to change notification settings - Fork 217
Fix component spec parsing #1370
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Deepak <[email protected]>
90960e1
to
eac6d1f
Compare
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.
@iddeepak Thanks a lot for fixing this.
The PR looks good to me.
@artur-ciocanu / @salaboy / @cicoyle Can you folks please help trigger the build for this ?
workflows running |
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
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.
I think the metadata parsing is also broken.
Compare the expected result with the original statestore.yaml
.
I think the expected metadata should look more like this:
const expectedComponentYaml =
"apiVersion: dapr.io/v1alpha1\n"
+ "kind: Component\n"
+ "metadata:\n"
+ " name: statestore\n"
+ "spec:\n"
+ " type: state.redis\n"
+ " version: v1\n"
+ " metadata:\n"
+ " - name: keyPrefix\n"
+ " value: name\n"
+ " - name: redisHost\n"
+ " value: redis:6379\n"
+ " - name: redisPassword\n"
+ " value: ''\n"
Each Map in the List of Maps should result in one MetadataEntry being added to metadataEntries, but two are actually being added:
for (Map<String, String> specMetadataItem : specMetadata) {
for (Map.Entry<String, String> metadataItem : specMetadataItem.entrySet()) {
metadataEntries.add(new MetadataEntry(metadataItem.getKey(), metadataItem.getValue()));
}
}
Should I create a new ticket for that?
@joebowbeer Yes but also a test .. because it is working as far as I know. |
@salaboy There is a test but I think its expected result is wrong: Its metadata is very different from the original
|
Fixed broken metadata and updated changes to same PR now. |
Signed-off-by: Deepak <[email protected]>
Signed-off-by: Deepak <[email protected]>
83ff8c9
to
16a2aa6
Compare
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
@salaboy This method withComponent(path) has never worked AFAICT because type has always been null, therefore it doesn't surprise me that the parsing of specMetadata was also broken.
@iddeepak A style violation is causing a build step to fail?
|
Signed-off-by: Deepak <[email protected]>
bb8155a
to
35b6588
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1370 +/- ##
============================================
+ Coverage 76.91% 77.49% +0.58%
- Complexity 1592 1772 +180
============================================
Files 145 204 +59
Lines 4843 5444 +601
Branches 562 597 +35
============================================
+ Hits 3725 4219 +494
- Misses 821 905 +84
- Partials 297 320 +23 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This PR resolves the issue described in #1368 by updating the parsing logic in
DaprContainer.withComponent(path)
.Previously, the
type
field was incorrectly read from the root level of the component YAML. This caused thetype
to benull
, even though it was correctly defined under thespec
section.The logic has now been fixed to correctly extract
type
andmetadata
from withinspec
.The corresponding test has also been updated to validate against the expected YAML structure, including
type: state.redis
and accuratemetadata
.Issue reference
Closes #1368
Checklist