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

Feature update comp status #167

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replace github.com/anexia-it/fsquota => github.com/aosedge/fsquota v0.0.0-202311

require (
code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b
github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a
github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df
github.com/apparentlymart/go-cidr v1.1.0
github.com/cavaliergopher/grab/v3 v3.0.1
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b h1:/2OEIBwZAaJ8n8iTXrM4v/+bdyLDTLwcW6RZtkO4+r0=
code.cloudfoundry.org/bytefmt v0.0.0-20231017140541-3b893ed0421b/go.mod h1:CKNYSQxmKcMCNIKoRG5rRR4AIgJMIoK65ya+Z5xHnk4=
github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a h1:vTyrUt3lGoPbiAAf+ckr2vreksbK4pGi/KmM9GNoUKI=
github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a/go.mod h1:CG/e1tQPMo2fvdwRHi+Cx5StpNURu7InTZSgyfmBVYM=
github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df h1:9dD1t9oC7Qbig7KZVuWZX8a7Zi3NW3JKDmsoYPsOMbM=
github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df/go.mod h1:CG/e1tQPMo2fvdwRHi+Cx5StpNURu7InTZSgyfmBVYM=
github.com/aosedge/crypto11 v1.0.3-0.20220217163524-ddd0ace39e6f h1:xL5hA9axQFHnoVVF/Q8CkKl9JiTvA7U72jRDltMBB9M=
github.com/aosedge/crypto11 v1.0.3-0.20220217163524-ddd0ace39e6f/go.mod h1:ILDKtnCKiQ7zRoNxcp36Y1ZR8LBPmR2E23+wTQe/MlE=
github.com/aosedge/fsquota v0.0.0-20231127111317-842d831105a7 h1:KR+SuYXJ9HigUaJdUwRlkDOOpkCrliFF3liBVKu2GKY=
Expand Down
2 changes: 1 addition & 1 deletion umcontroller/umcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ func (umCtrl *Controller) notifyNewComponents(umID string, componsStatus []syste
ComponentID: status.componentID,
ComponentType: status.componentType,
Version: status.version,
NodeID: umID,
NodeID: &umID,
Status: status.status,
}

Expand Down
8 changes: 6 additions & 2 deletions umcontroller/umcontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ func TestNewComponentsUpdate(t *testing.T) {
select {
case newComponents := <-umCtrl.NewComponentsChannel():
if !reflect.DeepEqual(newComponents, []cloudprotocol.ComponentStatus{
{ComponentID: "component3", Version: "1.0.0", Status: "installed", NodeID: "umID2"},
{ComponentID: "component4", Version: "1.0.0", Status: "installed", NodeID: "umID2"},
{ComponentID: "component3", Version: "1.0.0", Status: "installed", NodeID: convertToNodeID("umID2")},
{ComponentID: "component4", Version: "1.0.0", Status: "installed", NodeID: convertToNodeID("umID2")},
}) {
t.Errorf("Incorrect new components: %v", newComponents)
}
Expand Down Expand Up @@ -1897,3 +1897,7 @@ func generateFile(fileName string, size uint64) (err error) {
func convertToComponentID(id string) *string {
return &id
}

func convertToNodeID(nodeID string) *string {
return &nodeID
}
10 changes: 7 additions & 3 deletions unitstatushandler/unitstatushandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,15 +1175,15 @@ func TestNewComponents(t *testing.T) {
newComponents := []cloudprotocol.ComponentStatus{
{
ComponentID: "comp1", ComponentType: "type1", Version: "1.0.0",
Status: cloudprotocol.InstalledStatus, NodeID: "node1",
Status: cloudprotocol.InstalledStatus, NodeID: convertToNodeID("node1"),
},
{
ComponentID: "comp2", ComponentType: "type2", Version: "1.0.0",
Status: cloudprotocol.InstalledStatus, NodeID: "node2",
Status: cloudprotocol.InstalledStatus, NodeID: convertToNodeID("node2"),
},
{
ComponentID: "comp3", ComponentType: "type3", Version: "1.0.0",
Status: cloudprotocol.InstalledStatus, NodeID: "node3",
Status: cloudprotocol.InstalledStatus, NodeID: convertToNodeID("node3"),
},
}

Expand Down Expand Up @@ -1388,3 +1388,7 @@ func handleUpdateStatus(handler *unitstatushandler.Instance) {
func convertToComponentID(id string) *string {
return &id
}

func convertToNodeID(nodeID string) *string {
return &nodeID
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ github.com/ThalesIgnite/crypto11
# github.com/anexia-it/fsquota v0.0.0-00010101000000-000000000000 => github.com/aosedge/fsquota v0.0.0-20231127111317-842d831105a7
## explicit; go 1.21
github.com/anexia-it/fsquota
# github.com/aosedge/aos_common v0.0.0-20240902084419-53e429d5c68a
# github.com/aosedge/aos_common v0.0.0-20240919073545-c003861229df
## explicit; go 1.21
github.com/aosedge/aos_common/aoserrors
github.com/aosedge/aos_common/aostypes
Expand Down
Loading