go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/id/platformid/linux_test.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package platformid 5 6 import ( 7 "path/filepath" 8 "testing" 9 10 "github.com/stretchr/testify/assert" 11 "github.com/stretchr/testify/require" 12 "go.mondoo.com/cnquery/providers/os/connection/mock" 13 ) 14 15 func TestLinuxMachineId(t *testing.T) { 16 filepath, _ := filepath.Abs("./testdata/linux_test.toml") 17 provider, err := mock.New(filepath, nil) 18 require.NoError(t, err) 19 20 lid := LinuxIdProvider{connection: provider} 21 id, err := lid.ID() 22 require.NoError(t, err) 23 24 assert.Equal(t, "39827700b8d246eb9446947c573ecff2", id, "machine id is properly detected") 25 }