Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

kola/tests: add test for MachineID #805

Merged
merged 1 commit into from
Feb 2, 2018
Merged
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
12 changes: 12 additions & 0 deletions kola/tests/coretest/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func init() {
"ReadOnly": TestReadOnlyFs,
"RandomUUID": TestFsRandomUUID,
"Useradd": TestUseradd,
"MachineID": TestMachineID,
},
})
register.Register(&register.Test{
Expand Down Expand Up @@ -337,3 +338,14 @@ func TestUseradd() error {

return nil
}

// Test that /etc/machine-id isn't empty or COREOS_BLANK_MACHINE_ID
func TestMachineID() error {
id := MachineID()
if id == "" {
return fmt.Errorf("machine-id is empty")
} else if id == "COREOS_BLANK_MACHINE_ID" {
return fmt.Errorf("machine-id is %s", id)
}
return nil
}