From 5fa2de95997a5726758edfd6c975674ee87f25c7 Mon Sep 17 00:00:00 2001 From: RebeccaMahany Date: Wed, 3 Jul 2024 14:22:44 -0400 Subject: [PATCH] Rename Platform to Filter --- ee/katc/config.go | 5 +++-- ee/katc/config_test.go | 10 +++++----- ee/katc/table_test.go | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ee/katc/config.go b/ee/katc/config.go index 5915acbea..9effc54e8 100644 --- a/ee/katc/config.go +++ b/ee/katc/config.go @@ -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"` @@ -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 } diff --git a/ee/katc/config_test.go b/ee/katc/config_test.go index e95fa9e12..3838a5566 100644 --- a/ee/katc/config_test.go +++ b/ee/katc/config_test.go @@ -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\";", @@ -37,7 +37,7 @@ 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;", @@ -45,7 +45,7 @@ func TestConstructKATCTables(t *testing.T) { }`, 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;", @@ -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;" @@ -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;", diff --git a/ee/katc/table_test.go b/ee/katc/table_test.go index 6261f5feb..fbef23f39 100644 --- a/ee/katc/table_test.go +++ b/ee/katc/table_test.go @@ -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;",