fleet/orbit/pkg/table/windowsupdatetable/windowsupdate_test.go
Jahziel Villasana-Espinoza 87f4a28419
fix: use zerolog for orbit osquery table logging (#20028)
> Related issue: #19886 

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [x] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [x] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
2024-06-27 13:26:20 -04:00

46 lines
991 B
Go

//go:build windows
// +build windows
// based on github.com/kolide/launcher/pkg/osquery/tables
package windowsupdatetable
import (
"context"
"testing"
"time"
"github.com/fleetdm/fleet/v4/orbit/pkg/table/tablehelpers"
"github.com/rs/zerolog"
"github.com/stretchr/testify/require"
)
func TestTable(t *testing.T) {
t.Parallel()
tests := []struct {
name string
queryFunc queryFuncType
}{
{name: "updates", queryFunc: queryUpdates},
{name: "history", queryFunc: queryHistory},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
table := Table{
logger: zerolog.Nop(),
queryFunc: tt.queryFunc,
}
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
defer cancel()
// ci doesn't return data, but we can, at least, check that the underlying API doesn't error.
_, err := table.generate(ctx, tablehelpers.MockQueryContext(nil))
require.NoError(t, err, "generate")
})
}
}