Skip to content
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
797 changes: 405 additions & 392 deletions api/grpc/mpi/v1/command.pb.go

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions api/grpc/mpi/v1/command.pb.validate.go

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

2 changes: 2 additions & 0 deletions api/grpc/mpi/v1/command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ message ContainerInfo {
string container_id = 1 [(buf.validate.field).string.uuid = true];
// The name of the host
string hostname = 2 [(buf.validate.field).string.address = true];
// Release information of the container
ReleaseInfo release_info = 3;
}

// A response to a CreateConnectionRequest
Expand Down
2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/common.pb.go

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

2 changes: 1 addition & 1 deletion api/grpc/mpi/v1/files.pb.go

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

1 change: 1 addition & 0 deletions docs/proto/protos.md
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ Container information
| ----- | ---- | ----- | ----------- |
| container_id | [string](#string) | | The identifier of the container |
| hostname | [string](#string) | | The name of the host |
| release_info | [ReleaseInfo](#mpi-v1-ReleaseInfo) | | Release information of the container |



Expand Down
1 change: 1 addition & 0 deletions internal/datasource/host/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func (i *Info) ContainerInfo(ctx context.Context) *v1.Resource_ContainerInfo {
ContainerInfo: &v1.ContainerInfo{
ContainerId: i.getContainerID(),
Hostname: hostname,
ReleaseInfo: i.getReleaseInfo(ctx, i.osReleaseLocation),
},
}
}
Expand Down
18 changes: 17 additions & 1 deletion internal/datasource/host/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,20 @@ func TestInfo_IsContainer(t *testing.T) {

func TestInfo_ContainerInfo(t *testing.T) {
ctx := context.Background()

osReleaseFile := helpers.CreateFileWithErrorCheck(t, os.TempDir(), "os-release")
defer helpers.RemoveFileWithErrorCheck(t, osReleaseFile.Name())
err := os.WriteFile(osReleaseFile.Name(), []byte(ubuntuReleaseInfo), os.ModeAppend)
require.NoError(t, err)

releaseInfo := &v1.ReleaseInfo{
Codename: "jammy",
Id: "ubuntu",
Name: "Ubuntu",
VersionId: "22.04",
Version: "22.04.5 LTS (Jammy Jellyfish)",
}

tests := []struct {
name string
mountInfo string
Expand Down Expand Up @@ -501,8 +515,9 @@ func TestInfo_ContainerInfo(t *testing.T) {

execMock := &execfakes.FakeExecInterface{}
execMock.HostnameReturns(test.expectHostname, nil)
execMock.ReleaseInfoReturns(releaseInfo)

_, err := mountInfoFile.WriteString(test.mountInfo)
_, err = mountInfoFile.WriteString(test.mountInfo)
require.NoError(tt, err)

err = mountInfoFile.Close()
Expand All @@ -515,6 +530,7 @@ func TestInfo_ContainerInfo(t *testing.T) {

assert.Equal(tt, test.expectContainerID, containerInfo.ContainerInfo.GetContainerId())
assert.Equal(tt, test.expectHostname, containerInfo.ContainerInfo.GetHostname())
assert.Equal(t, releaseInfo, containerInfo.ContainerInfo.GetReleaseInfo())
})
}
}
Expand Down