github.com/lacework-dev/go-moby@v20.10.12+incompatible/pkg/parsers/kernel/kernel_darwin_test.go (about)

     1  package kernel
     2  
     3  import (
     4  	"testing"
     5  
     6  	"gotest.tools/v3/assert"
     7  )
     8  
     9  func TestGetRelease(t *testing.T) {
    10  	// example output of "system_profiler SPSoftwareDataType"
    11  	const spSoftwareDataType = `Software:
    12  
    13      System Software Overview:
    14  
    15        System Version: macOS 10.14.6 (18G4032)
    16        Kernel Version: Darwin 18.7.0
    17        Boot Volume: fastfood
    18        Boot Mode: Normal
    19        Computer Name: Macintosh
    20        User Name: Foobar (foobar)
    21        Secure Virtual Memory: Enabled
    22        System Integrity Protection: Enabled
    23        Time since boot: 6 days 23:16
    24  `
    25  	release, err := getRelease(spSoftwareDataType)
    26  	assert.NilError(t, err)
    27  	assert.Equal(t, release, "18.7.0")
    28  }