-
Notifications
You must be signed in to change notification settings - Fork 56
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
add removal of nodes / branches v2 #348
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c86821b
add 'delete' element for node/branch removal
nwesem c357d32
use matrix testing to prevent code duplication
nwesem db92b7e
update documentation and tests according to PR https://github.com/COV…
nwesem be1b085
extend tests for instances and deletion of wrong instance
nwesem 55effdb
fix pre-commit
nwesem File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
**/out.json | ||
**/out.txt | ||
**/out.vspec | ||
**/out.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0, which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A: | ||
type: branch | ||
description: A is a test node | ||
A.Float: | ||
datatype: float | ||
type: actuator | ||
unit: mm | ||
description: A.Float is a leaf of A of datatype float. | ||
A.Int16: | ||
datatype: int16 | ||
type: sensor | ||
unit: rpm | ||
description: A.Int16 is a leaf of A of datatype int16. | ||
A.String: | ||
datatype: string | ||
type: sensor | ||
description: A.String is a leaf of A of datatype string. | ||
deprecation: This is test deprecation, let's say it used to be called Str instead String. | ||
A.StringArray: | ||
datatype: string[] | ||
type: sensor | ||
description: A.StringArray is a leaf of A of datatype string array. | ||
A.B: | ||
type: branch | ||
description: B is a branch of A. | ||
A.B.Int32: | ||
datatype: int32 | ||
type: sensor | ||
unit: rpm | ||
description: A.B.Int32 is a leaf of A.B of datatype int32. | ||
A.B.NewName: | ||
datatype: uint32 | ||
type: sensor | ||
unit: mm | ||
description: A.B.NewName's old name is 'OldName'. And its even older name is 'OlderName'. | ||
fka: ['A.B.OlderName', 'A.B.OldName'] | ||
A.B.IsLeaf: | ||
datatype: string | ||
type: actuator | ||
allowed: ["YES", "NO"] | ||
description: This node is a leaf of the tree and it has allowed values (aka an enum). | ||
A.B.Min: | ||
datatype: uint8 | ||
type: sensor | ||
min: 10 | ||
unit: percent | ||
description: A leaf that uses a minimum value. | ||
A.B.Max: | ||
datatype: uint8 | ||
type: sensor | ||
unit: percent | ||
min: 0 | ||
max: 100 | ||
description: A leaf that uses a maximum value. | ||
A.C: | ||
type: branch | ||
description: C is a branch of A. | ||
instances: Instance[1,2] | ||
A.C.Test: | ||
datatype: uint32 | ||
type: sensor | ||
unit: mm | ||
description: A.C.Test is a leaf of A.C of datatype uint32. |
11 changes: 11 additions & 0 deletions
11
tests/vspec/test_node_removal/test_files/test_del_branch_overlay.vspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0, which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A.B: | ||
type: branch | ||
delete: true |
11 changes: 11 additions & 0 deletions
11
tests/vspec/test_node_removal/test_files/test_del_instance_overlay.vspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0, which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A.C.Instance2: | ||
type: branch | ||
delete: true |
12 changes: 12 additions & 0 deletions
12
tests/vspec/test_node_removal/test_files/test_del_node_overlay.vspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0, which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A.B.Int32: | ||
type: sensor | ||
datatype: int32 | ||
delete: true |
11 changes: 11 additions & 0 deletions
11
tests/vspec/test_node_removal/test_files/test_del_wrong_instance_overlay.vspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0, which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A.C.Instance3: | ||
type: branch | ||
delete: true |
72 changes: 72 additions & 0 deletions
72
tests/vspec/test_node_removal/test_files/test_deleted_branch.vspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0, which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A: | ||
type: branch | ||
description: A is a test node | ||
A.Float: | ||
datatype: float | ||
type: actuator | ||
unit: mm | ||
description: A.Float is a leaf of A of datatype float. | ||
A.Int16: | ||
datatype: int16 | ||
type: sensor | ||
unit: rpm | ||
description: A.Int16 is a leaf of A of datatype int16. | ||
A.String: | ||
datatype: string | ||
type: sensor | ||
description: A.String is a leaf of A of datatype string. | ||
deprecation: This is test deprecation, let's say it used to be called Str instead String. | ||
A.StringArray: | ||
datatype: string[] | ||
type: sensor | ||
description: A.StringArray is a leaf of A of datatype string array. | ||
A.B: | ||
type: branch | ||
description: B is a branch of A. | ||
delete: true | ||
A.B.Int32: | ||
datatype: int32 | ||
type: sensor | ||
unit: rpm | ||
description: A.B.Int32 is a leaf of A.B of datatype int32. | ||
A.B.NewName: | ||
datatype: uint32 | ||
type: sensor | ||
unit: mm | ||
description: A.B.NewName's old name is 'OldName'. And its even older name is 'OlderName'. | ||
fka: ['A.B.OlderName', 'A.B.OldName'] | ||
A.B.IsLeaf: | ||
datatype: string | ||
type: actuator | ||
allowed: ["YES", "NO"] | ||
description: This node is a leaf of the tree and it has allowed values (aka an enum). | ||
A.B.Min: | ||
datatype: uint8 | ||
type: sensor | ||
min: 10 | ||
unit: percent | ||
description: A leaf that uses a minimum value. | ||
A.B.Max: | ||
datatype: uint8 | ||
type: sensor | ||
unit: percent | ||
min: 0 | ||
max: 100 | ||
description: A leaf that uses a maximum value. | ||
A.C: | ||
type: branch | ||
description: C is a branch of A. | ||
instances: Instance[1,2] | ||
A.C.Test: | ||
datatype: uint32 | ||
type: sensor | ||
unit: mm | ||
description: A.C.Test is a leaf of A.C of datatype uint32. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It's neat that this works, BTW. Cool!
As a side question, what kind of error is generated if one tries to delete a non-existing instance? Is it differentiated from an error message generated by trying to delete a node that has no instances?
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.
done even added a test for this case, it fails at this position in the code: