mirror of
https://github.com/fleetdm/fleet
synced 2026-05-01 18:37:37 +00:00
> 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)).
46 lines
991 B
Go
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")
|
|
})
|
|
}
|
|
}
|