fleet/server/datastore/datastore_test.go
billcobbler 618ba56484
Add host additional info filters (#28)
This change adds the ability to filter additional host info via the list hosts endpoint; a continuation from [here](https://github.com/kolide/fleet/pull/2330), but now filtering is accomplished via SQL. 

Additional object without filter:
```
curl 'https://localhost:8080/api/v1/kolide/hosts'
...
"additional": {
        "macs": [
          {
            "mac": "00:00:00:00:00:00"
          },
          {
            "mac": "02:42:c0:a8:10:05"
          }
        ],
        "time": [
          {
            "day": "13",
            "hour": "3",
            "year": "2020",
            "month": "10",
            "minutes": "43",
            "seconds": "11",
            "weekday": "Tuesday",
            "datetime": "2020-10-13T03:43:11Z",
            "iso_8601": "2020-10-13T03:43:11Z",
            "timezone": "GMT",
            "timestamp": "Tue Oct 13 03:43:11 2020 UTC",
            "unix_time": "1602560591",
            "local_time": "1602560591",
            "local_timezone": "UTC"
          }
},
...
```

Additional object with filter:
```
curl 'https://localhost:8080/api/v1/kolide/hosts?additional_info_filters=macs,notreal'
...
"additional": {
        "macs": [
          {
            "mac": "00:00:00:00:00:00"
          },
          {
            "mac": "02:42:c0:a8:10:05"
          }
        ],
        "notreal": null
},
...
```
2020-11-13 16:33:25 -08:00

94 lines
2 KiB
Go

package datastore
import (
"testing"
"github.com/fleetdm/fleet/server/kolide"
)
var testFunctions = [...]func(*testing.T, kolide.Datastore){
testOrgInfo,
testAdditionalQueries,
testEnrollSecrets,
testEnrollSecretsCaseSensitive,
testEnrollSecretRoundtrip,
testCreateInvite,
testInviteByEmail,
testInviteByToken,
testListInvites,
testDeleteInvite,
testSaveInvite,
testDeleteQuery,
testDeleteQueries,
testSaveQuery,
testListQuery,
testDeletePack,
testNewPack,
testEnrollHost,
testAuthenticateHost,
testAuthenticateHostCaseSensitive,
testLabels,
testSaveLabel,
testManagingLabelsOnPacks,
testPasswordResetRequests,
testCreateUser,
testSaveUser,
testUserByID,
testPasswordResetRequests,
testSearchHosts,
testSearchHostsLimit,
testSearchLabels,
testSearchLabelsLimit,
testListHostsInLabel,
testListUniqueHostsInLabels,
testSaveHosts,
testDeleteHost,
testListHosts,
testListHostsFilterAdditional,
testListHostsStatus,
testListHostsInPack,
testListPacksForHost,
testHostIDsByName,
testHostByIdentifier,
testListPacks,
testDistributedQueryCampaign,
testCleanupDistributedQueryCampaigns,
testBuiltInLabels,
testLoadPacksForQueries,
testScheduledQuery,
testDeleteScheduledQuery,
testNewScheduledQuery,
testListScheduledQueriesInPack,
testCascadingDeletionOfQueries,
testGetPackByName,
testGetQueryByName,
testAddLabelToPackTwice,
testGenerateHostStatusStatistics,
testMarkHostSeen,
testCleanupIncomingHosts,
testDuplicateNewQuery,
testChangeEmail,
testChangeLabelDetails,
testMigrationStatus,
testUnicode,
testCountHostsInTargets,
testHostStatus,
testHostIDsInTargets,
testApplyOsqueryOptions,
testApplyOsqueryOptionsNoOverrides,
testOsqueryOptionsForHost,
testApplyQueries,
testApplyPackSpecRoundtrip,
testApplyPackSpecMissingQueries,
testApplyPackSpecMissingName,
testGetPackSpec,
testApplyLabelSpecsRoundtrip,
testGetLabelSpec,
testLabelIDsByName,
testListLabelsForPack,
testHostAdditional,
testCarveMetadata,
testCarveBlocks,
testCarveListCarves,
testCarveCleanupCarves,
}