Skip to content

Commit

Permalink
Rename Platform to Filter
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaMahany committed Jul 3, 2024
1 parent b3f251c commit 5fa2de9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions ee/katc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (r *rowTransformStep) UnmarshalJSON(data []byte) error {
type katcTableConfig struct {
SourceType katcSourceType `json:"source_type"`
SourcePaths []string `json:"source_paths"` // Describes how to connect to source (e.g. path to db) -- % and _ wildcards supported
Platform string `json:"platform"`
Filter string `json:"filter"`
Columns []string `json:"columns"`
SourceQuery string `json:"source_query"` // Query to run against each source path
RowTransformSteps []rowTransformStep `json:"row_transform_steps"`
Expand All @@ -113,7 +113,8 @@ func ConstructKATCTables(config map[string]string, slogger *slog.Logger) []osque
continue
}

if cfg.Platform != runtime.GOOS {
// For now, the filter is simply the OS
if cfg.Filter != runtime.GOOS {
continue
}

Expand Down
10 changes: 5 additions & 5 deletions ee/katc/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestConstructKATCTables(t *testing.T) {
katcConfig: map[string]string{
"kolide_snappy_sqlite_test": fmt.Sprintf(`{
"source_type": "sqlite",
"platform": "%s",
"filter": "%s",
"columns": ["data"],
"source_paths": ["/some/path/to/db.sqlite"],
"source_query": "SELECT data FROM object_data JOIN object_store ON (object_data.object_store_id = object_store.id) WHERE object_store.name=\"testtable\";",
Expand All @@ -37,15 +37,15 @@ func TestConstructKATCTables(t *testing.T) {
katcConfig: map[string]string{
"test_1": fmt.Sprintf(`{
"source_type": "sqlite",
"platform": "%s",
"filter": "%s",
"columns": ["data"],
"source_paths": ["/some/path/to/db.sqlite"],
"source_query": "SELECT data FROM object_data;",
"row_transform_steps": ["snappy"]
}`, runtime.GOOS),
"test_2": fmt.Sprintf(`{
"source_type": "sqlite",
"platform": "%s",
"filter": "%s",
"columns": ["col1", "col2"],
"source_paths": ["/some/path/to/a/different/db.sqlite"],
"source_query": "SELECT col1, col2 FROM some_table;",
Expand All @@ -66,7 +66,7 @@ func TestConstructKATCTables(t *testing.T) {
katcConfig: map[string]string{
"kolide_snappy_test": fmt.Sprintf(`{
"source_type": "unknown_source",
"platform": "%s",
"filter": "%s",
"columns": ["data"],
"source_paths": ["/some/path/to/db.sqlite"],
"source_query": "SELECT data FROM object_data;"
Expand All @@ -79,7 +79,7 @@ func TestConstructKATCTables(t *testing.T) {
katcConfig: map[string]string{
"kolide_snappy_test": fmt.Sprintf(`{
"source_type": "sqlite",
"platform": "%s",
"filter": "%s",
"columns": ["data"],
"source_paths": ["/some/path/to/db.sqlite"],
"source_query": "SELECT data FROM object_data;",
Expand Down
2 changes: 1 addition & 1 deletion ee/katc/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func Test_generate_SqliteBackedIndexedDB(t *testing.T) {
name: sqliteSourceType,
dataFunc: sqliteData,
},
Platform: runtime.GOOS,
Filter: runtime.GOOS,
Columns: []string{expectedColumn},
SourcePaths: []string{filepath.Join(databaseDir, "%.sqlite")}, // All sqlite files in the test directory
SourceQuery: "SELECT data FROM object_data;",
Expand Down

0 comments on commit 5fa2de9

Please sign in to comment.