Skip to content

Commit c5863c0

Browse files
committed
chore: update the protos
1 parent d1284cf commit c5863c0

File tree

7 files changed

+460
-399
lines changed

7 files changed

+460
-399
lines changed

api/grpc/mpi/v1/command.pb.go

Lines changed: 405 additions & 392 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/command.pb.validate.go

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/common.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/mpi/v1/files.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/proto/protos.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ Container information
721721
| ----- | ---- | ----- | ----------- |
722722
| container_id | [string](#string) | | The identifier of the container |
723723
| hostname | [string](#string) | | The name of the host |
724+
| release_info | [ReleaseInfo](#mpi-v1-ReleaseInfo) | | Release information of the container |
724725

725726

726727

internal/datasource/host/info.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func (i *Info) ContainerInfo(ctx context.Context) *v1.Resource_ContainerInfo {
144144
ContainerInfo: &v1.ContainerInfo{
145145
ContainerId: i.getContainerID(),
146146
Hostname: hostname,
147+
ReleaseInfo: i.getReleaseInfo(ctx, i.osReleaseLocation),
147148
},
148149
}
149150
}
@@ -301,7 +302,7 @@ func (i *Info) getReleaseInfo(ctx context.Context, osReleaseLocation string) (re
301302

302303
return hostReleaseInfo
303304
}
304-
305+
305306
return mergeHostAndOsReleaseInfo(hostReleaseInfo, osRelease)
306307
}
307308

internal/datasource/host/info_test.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,26 @@ func TestInfo_IsContainer(t *testing.T) {
426426

427427
func TestInfo_ContainerInfo(t *testing.T) {
428428
ctx := context.Background()
429+
430+
osReleaseFile := helpers.CreateFileWithErrorCheck(t, os.TempDir(), "os-release")
431+
defer helpers.RemoveFileWithErrorCheck(t, osReleaseFile.Name())
432+
err := os.WriteFile(osReleaseFile.Name(), []byte(ubuntuReleaseInfo), os.ModeAppend)
433+
require.NoError(t, err)
434+
435+
releaseInfo := &v1.ReleaseInfo{
436+
Codename: "focal",
437+
Id: "ubuntu",
438+
Name: "Ubuntu",
439+
VersionId: "20.04",
440+
Version: "20.04.5 LTS (Focal Fossa)",
441+
}
442+
429443
tests := []struct {
430-
name string
431-
mountInfo string
432-
expectContainerID string
433-
expectHostname string
444+
name string
445+
mountInfo string
446+
expectContainerID string
447+
expectHostname string
448+
expectedOSReleaseInfo string
434449
}{
435450
{
436451
name: "unknown cgroups format",
@@ -501,6 +516,7 @@ func TestInfo_ContainerInfo(t *testing.T) {
501516

502517
execMock := &execfakes.FakeExecInterface{}
503518
execMock.HostnameReturns(test.expectHostname, nil)
519+
execMock.ReleaseInfoReturns(releaseInfo)
504520

505521
_, err := mountInfoFile.WriteString(test.mountInfo)
506522
require.NoError(tt, err)
@@ -515,6 +531,7 @@ func TestInfo_ContainerInfo(t *testing.T) {
515531

516532
assert.Equal(tt, test.expectContainerID, containerInfo.ContainerInfo.GetContainerId())
517533
assert.Equal(tt, test.expectHostname, containerInfo.ContainerInfo.GetHostname())
534+
assert.Equal(t, releaseInfo, containerInfo.ContainerInfo.GetReleaseInfo())
518535
})
519536
}
520537
}

0 commit comments

Comments
 (0)