go.mondoo.com/cnquery@v0.0.0-20231005093811-59568235f6ea/providers/os/resources/packages_test.go (about) 1 // Copyright (c) Mondoo, Inc. 2 // SPDX-License-Identifier: BUSL-1.1 3 4 package resources_test 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestResource_Packages(t *testing.T) { 13 res := x.TestQuery(t, "packages") 14 assert.NotEmpty(t, res) 15 } 16 17 // FIXME: currently disabled because we have to feed the entire recording 18 // into the provider 19 func testResource_Package(t *testing.T) { 20 t.Run("existing package", func(t *testing.T) { 21 res := x.TestQuery(t, "package(\"acl\").installed") 22 assert.NotEmpty(t, res) 23 assert.Empty(t, res[0].Result().Error) 24 assert.Equal(t, true, res[0].Data.Value) 25 }) 26 27 t.Run("missing package", func(t *testing.T) { 28 res := x.TestQuery(t, "package(\"unknown\").installed") 29 assert.NotEmpty(t, res) 30 assert.Empty(t, res[0].Result().Error) 31 assert.Equal(t, false, res[0].Data.Value) 32 }) 33 }