diff --git a/.golangci.yaml b/.golangci.yaml index a0b970e0b6e..3628a66e2d4 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -19,6 +19,9 @@ linters: - asciicheck - deadcode - errcheck + # Although goimports includes gofmt, it doesn't support the simplify option. + # So we include gofmt here. + - gofmt - gosimple - ineffassign - makezero @@ -37,8 +40,6 @@ linters: # - wastedassign - whitespace disable: - # We run goimports which includes gofmt. - - gofmt # The following linters are run separately by arcanist at the moment. # This is because we have autofix hooks for these linters. - goimports diff --git a/src/cloud/api/controllers/auth_grpc_test.go b/src/cloud/api/controllers/auth_grpc_test.go index 7906f82540e..02839eb125d 100644 --- a/src/cloud/api/controllers/auth_grpc_test.go +++ b/src/cloud/api/controllers/auth_grpc_test.go @@ -69,7 +69,7 @@ func TestAuthServer_LoginAPIKey(t *testing.T) { _, mockClients, cleanup := testutils.CreateTestAPIEnv(t) defer cleanup() md := map[string][]string{ - "pixie-api-key": []string{"test-token"}, + "pixie-api-key": {"test-token"}, } ctx := metadata.NewIncomingContext(context.Background(), md) diff --git a/src/cloud/api/controllers/org_resolver_test.go b/src/cloud/api/controllers/org_resolver_test.go index b31eb287c54..a2c0221541a 100644 --- a/src/cloud/api/controllers/org_resolver_test.go +++ b/src/cloud/api/controllers/org_resolver_test.go @@ -360,11 +360,11 @@ func TestOrgSettingsResolver_IDEConfigs(t *testing.T) { }). Return(&cloudpb.GetOrgIDEConfigsResponse{ Configs: []*cloudpb.IDEConfig{ - &cloudpb.IDEConfig{ + { IDEName: "test", Path: "subl://{{symbol}}", }, - &cloudpb.IDEConfig{ + { IDEName: "anothertest", Path: "test://{{symbol}}", }, diff --git a/src/cloud/api/controllers/org_test.go b/src/cloud/api/controllers/org_test.go index f1492d45f9c..37aedcf65e9 100644 --- a/src/cloud/api/controllers/org_test.go +++ b/src/cloud/api/controllers/org_test.go @@ -442,11 +442,11 @@ func TestOrganizationServiceServer_GetOrgIDEConfigs(t *testing.T) { OrgID: utils.ProtoFromUUIDStrOrNil("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), }).Return(&profilepb.GetOrgIDEConfigsResponse{ Configs: []*profilepb.IDEConfig{ - &profilepb.IDEConfig{ + { IDEName: "test", Path: "test://{{symbol}}", }, - &profilepb.IDEConfig{ + { IDEName: "another-test", Path: "sublime://{{symbol}}", }, @@ -461,11 +461,11 @@ func TestOrganizationServiceServer_GetOrgIDEConfigs(t *testing.T) { require.NoError(t, err) assert.Equal(t, []*cloudpb.IDEConfig{ - &cloudpb.IDEConfig{ + { IDEName: "test", Path: "test://{{symbol}}", }, - &cloudpb.IDEConfig{ + { IDEName: "another-test", Path: "sublime://{{symbol}}", }, diff --git a/src/cloud/api/controllers/plugin_resolver_test.go b/src/cloud/api/controllers/plugin_resolver_test.go index 5d7e0910377..916a9ab89ba 100644 --- a/src/cloud/api/controllers/plugin_resolver_test.go +++ b/src/cloud/api/controllers/plugin_resolver_test.go @@ -40,7 +40,7 @@ func TestPluginResolver_Plugins(t *testing.T) { Kind: cloudpb.PK_RETENTION, }).Return(&cloudpb.GetPluginsResponse{ Plugins: []*cloudpb.Plugin{ - &cloudpb.Plugin{ + { Name: "Test Plugin", Id: "test-plugin", Description: "Here is a plugin that is used for this test", @@ -50,7 +50,7 @@ func TestPluginResolver_Plugins(t *testing.T) { RetentionEnabled: false, EnabledVersion: "", }, - &cloudpb.Plugin{ + { Name: "Another Plugin", Id: "another-plugin", Description: "Here is a another plugin that is used for this test", @@ -319,7 +319,7 @@ func TestPluginResolver_RetentionScripts(t *testing.T) { mockClients.MockPlugin.EXPECT().GetRetentionScripts(gomock.Any(), &cloudpb.GetRetentionScriptsRequest{}).Return(&cloudpb.GetRetentionScriptsResponse{ Scripts: []*cloudpb.RetentionScript{ - &cloudpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("1ba7b810-9dad-11d1-80b4-00c04fd430c8"), ScriptName: "Test Script", Description: "This is a script", @@ -332,7 +332,7 @@ func TestPluginResolver_RetentionScripts(t *testing.T) { Enabled: true, IsPreset: false, }, - &cloudpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("1ba7b810-9dad-11d1-80b4-00c04fd430c1"), ScriptName: "Another Script", Description: "This is another script", diff --git a/src/cloud/api/controllers/plugins_grpc_test.go b/src/cloud/api/controllers/plugins_grpc_test.go index e6825461a44..d344cf7d0c4 100644 --- a/src/cloud/api/controllers/plugins_grpc_test.go +++ b/src/cloud/api/controllers/plugins_grpc_test.go @@ -47,7 +47,7 @@ func TestGetPlugins(t *testing.T) { name: "regular user", ctx: CreateTestContext(), allPlugins: []*pluginpb.Plugin{ - &pluginpb.Plugin{ + { Name: "Test Plugin", ID: "test-plugin", Description: "Here is a plugin that is used for this test", @@ -55,7 +55,7 @@ func TestGetPlugins(t *testing.T) { LatestVersion: "2.0.0", RetentionEnabled: true, }, - &pluginpb.Plugin{ + { Name: "Another Plugin", ID: "another-plugin", Description: "Here is a another plugin that is used for this test", @@ -65,7 +65,7 @@ func TestGetPlugins(t *testing.T) { }, }, orgRetentionPlugins: []*pluginpb.GetRetentionPluginsForOrgResponse_PluginState{ - &pluginpb.GetRetentionPluginsForOrgResponse_PluginState{ + { Plugin: &pluginpb.Plugin{ Name: "Another Plugin", ID: "another-plugin", @@ -78,7 +78,7 @@ func TestGetPlugins(t *testing.T) { }, }, expectedPlugins: []*cloudpb.Plugin{ - &cloudpb.Plugin{ + { Name: "Test Plugin", Id: "test-plugin", Description: "Here is a plugin that is used for this test", @@ -88,7 +88,7 @@ func TestGetPlugins(t *testing.T) { RetentionEnabled: false, EnabledVersion: "", }, - &cloudpb.Plugin{ + { Name: "Another Plugin", Id: "another-plugin", Description: "Here is a another plugin that is used for this test", @@ -104,7 +104,7 @@ func TestGetPlugins(t *testing.T) { name: "API user", ctx: CreateAPIUserTestContext(), allPlugins: []*pluginpb.Plugin{ - &pluginpb.Plugin{ + { Name: "Test Plugin", ID: "test-plugin", Description: "Here is a plugin that is used for this test", @@ -112,7 +112,7 @@ func TestGetPlugins(t *testing.T) { LatestVersion: "2.0.0", RetentionEnabled: true, }, - &pluginpb.Plugin{ + { Name: "Another Plugin", ID: "another-plugin", Description: "Here is a another plugin that is used for this test", @@ -122,7 +122,7 @@ func TestGetPlugins(t *testing.T) { }, }, orgRetentionPlugins: []*pluginpb.GetRetentionPluginsForOrgResponse_PluginState{ - &pluginpb.GetRetentionPluginsForOrgResponse_PluginState{ + { Plugin: &pluginpb.Plugin{ Name: "Another Plugin", ID: "another-plugin", @@ -135,7 +135,7 @@ func TestGetPlugins(t *testing.T) { }, }, expectedPlugins: []*cloudpb.Plugin{ - &cloudpb.Plugin{ + { Name: "Test Plugin", Id: "test-plugin", Description: "Here is a plugin that is used for this test", @@ -145,7 +145,7 @@ func TestGetPlugins(t *testing.T) { RetentionEnabled: false, EnabledVersion: "", }, - &cloudpb.Plugin{ + { Name: "Another Plugin", Id: "another-plugin", Description: "Here is a another plugin that is used for this test", @@ -342,7 +342,7 @@ func TestGetRetentionScripts(t *testing.T) { mockClients.MockDataRetentionPlugin.EXPECT().GetRetentionScripts(gomock.Any(), mockReq). Return(&pluginpb.GetRetentionScriptsResponse{ Scripts: []*pluginpb.RetentionScript{ - &pluginpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("1ba7b810-9dad-11d1-80b4-00c04fd430c8"), ScriptName: "Test Script", Description: "This is a script", @@ -355,7 +355,7 @@ func TestGetRetentionScripts(t *testing.T) { Enabled: true, IsPreset: false, }, - &pluginpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("1ba7b810-9dad-11d1-80b4-00c04fd430c1"), ScriptName: "Another Script", Description: "This is another script", @@ -379,7 +379,7 @@ func TestGetRetentionScripts(t *testing.T) { assert.Equal(t, &cloudpb.GetRetentionScriptsResponse{ Scripts: []*cloudpb.RetentionScript{ - &cloudpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("1ba7b810-9dad-11d1-80b4-00c04fd430c8"), ScriptName: "Test Script", Description: "This is a script", @@ -392,7 +392,7 @@ func TestGetRetentionScripts(t *testing.T) { Enabled: true, IsPreset: false, }, - &cloudpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("1ba7b810-9dad-11d1-80b4-00c04fd430c1"), ScriptName: "Another Script", Description: "This is another script", diff --git a/src/cloud/cron_script/controllers/server_test.go b/src/cloud/cron_script/controllers/server_test.go index 739d053ea65..18513ed4025 100644 --- a/src/cloud/cron_script/controllers/server_test.go +++ b/src/cloud/cron_script/controllers/server_test.go @@ -153,7 +153,7 @@ func TestServer_GetScripts(t *testing.T) { assert.Equal(t, &cronscriptpb.GetScriptsResponse{ Scripts: []*cronscriptpb.CronScript{ - &cronscriptpb.CronScript{ + { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", @@ -165,7 +165,7 @@ func TestServer_GetScripts(t *testing.T) { Enabled: true, FrequencyS: 5, }, - &cronscriptpb.CronScript{ + { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440002"), OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px()", @@ -201,11 +201,11 @@ func TestServer_CreateScript(t *testing.T) { VizierIDs: clusterIDs, }).Return(&vzmgrpb.GetVizierInfosResponse{ VizierInfos: []*cvmsgspb.VizierInfo{ - &cvmsgspb.VizierInfo{ + { VizierID: utils.ProtoFromUUIDStrOrNil(vz1ID), Status: cvmsgspb.VZ_ST_HEALTHY, }, - &cvmsgspb.VizierInfo{ + { VizierID: utils.ProtoFromUUIDStrOrNil(vz2ID), Status: cvmsgspb.VZ_ST_HEALTHY, }, @@ -431,11 +431,11 @@ func TestServer_UpdateScript(t *testing.T) { VizierIDs: clusterIDs, }).Return(&vzmgrpb.GetVizierInfosResponse{ VizierInfos: []*cvmsgspb.VizierInfo{ - &cvmsgspb.VizierInfo{ + { VizierID: utils.ProtoFromUUIDStrOrNil("323e4567-e89b-12d3-a456-426655440003"), Status: cvmsgspb.VZ_ST_HEALTHY, }, - &cvmsgspb.VizierInfo{ + { VizierID: utils.ProtoFromUUIDStrOrNil("323e4567-e89b-12d3-a456-426655440002"), Status: cvmsgspb.VZ_ST_HEALTHY, }, @@ -448,7 +448,7 @@ func TestServer_UpdateScript(t *testing.T) { }, }).Return(&vzmgrpb.GetVizierInfosResponse{ VizierInfos: []*cvmsgspb.VizierInfo{ - &cvmsgspb.VizierInfo{ + { VizierID: utils.ProtoFromUUIDStrOrNil("323e4567-e89b-12d3-a456-426655440000"), Status: cvmsgspb.VZ_ST_HEALTHY, }, @@ -516,7 +516,7 @@ func TestServer_DeleteScript(t *testing.T) { }, }).Return(&vzmgrpb.GetVizierInfosResponse{ VizierInfos: []*cvmsgspb.VizierInfo{ - &cvmsgspb.VizierInfo{ + { VizierID: vzIDpb, Status: cvmsgspb.VZ_ST_HEALTHY, }, @@ -595,7 +595,7 @@ func TestServer_HandleChecksumRequest(t *testing.T) { wg.Add(1) csMap := map[string]*cvmsgspb.CronScript{ - "123e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "123e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), Script: "px.stream()", FrequencyS: 10, @@ -654,7 +654,7 @@ func TestServer_HandleGetScriptsRequest(t *testing.T) { wg.Add(1) csMap := map[string]*cvmsgspb.CronScript{ - "123e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "123e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), Script: "px.stream()", FrequencyS: 10, diff --git a/src/cloud/plugin/controllers/server_test.go b/src/cloud/plugin/controllers/server_test.go index ef134c5e236..bff14f94a9e 100644 --- a/src/cloud/plugin/controllers/server_test.go +++ b/src/cloud/plugin/controllers/server_test.go @@ -98,13 +98,13 @@ func mustLoadTestData(db *sqlx.DB) { insertRetentionRelease := `INSERT INTO data_retention_plugin_releases(plugin_id, version, configurations, preset_scripts, documentation_url, default_export_url, allow_custom_export_url, allow_insecure_tls) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)` db.MustExec(insertRetentionRelease, "test-plugin", "0.0.1", controllers.Configurations(map[string]string{"license_key": "This is what we use to authenticate"}), controllers.PresetScripts([]*controllers.PresetScript{ - &controllers.PresetScript{ + { Name: "http data", Description: "This is a script to get http data", DefaultFrequencyS: 10, Script: "script", }, - &controllers.PresetScript{ + { Name: "http data 2", Description: "This is a script to get http data 2", DefaultFrequencyS: 20, @@ -112,13 +112,13 @@ func mustLoadTestData(db *sqlx.DB) { }, }), "http://test-doc-url", "http://test-export-url", true, false) db.MustExec(insertRetentionRelease, "test-plugin", "0.0.2", controllers.Configurations(map[string]string{"license_key2": "This is what we use to authenticate 2"}), controllers.PresetScripts([]*controllers.PresetScript{ - &controllers.PresetScript{ + { Name: "dns data", Description: "This is a script to get dns data", DefaultFrequencyS: 10, Script: "dns script", }, - &controllers.PresetScript{ + { Name: "dns data 2", Description: "This is a script to get dns data 2", DefaultFrequencyS: 20, @@ -127,13 +127,13 @@ func mustLoadTestData(db *sqlx.DB) { }), "http://test-doc-url2", "http://test-export-url2", true, true) db.MustExec(insertRetentionRelease, "test-plugin", "0.0.3", controllers.Configurations(map[string]string{"license_key3": "This is what we use to authenticate 3"}), nil, "http://test-doc-url3", "http://test-export-url3", true, true) db.MustExec(insertRetentionRelease, "another-plugin", "0.0.1", controllers.Configurations(map[string]string{"abcd": "Some field"}), controllers.PresetScripts([]*controllers.PresetScript{ - &controllers.PresetScript{ + { Name: "dns data", Description: "This is a script to get dns data", DefaultFrequencyS: 10, Script: "dns script", }, - &controllers.PresetScript{ + { Name: "dns data 2", Description: "This is a script to get dns data 2", DefaultFrequencyS: 20, @@ -181,7 +181,7 @@ func TestServer_GetPlugins(t *testing.T) { assert.Equal(t, 2, len(resp.Plugins)) assert.ElementsMatch(t, []*pluginpb.Plugin{ - &pluginpb.Plugin{ + { Name: "test_plugin", ID: "test-plugin", LatestVersion: "0.0.3", @@ -189,7 +189,7 @@ func TestServer_GetPlugins(t *testing.T) { Description: "This is the newest test plugin", Logo: "logo3", }, - &pluginpb.Plugin{ + { Name: "another_plugin", ID: "another-plugin", LatestVersion: "0.0.2", @@ -214,7 +214,7 @@ func TestServer_GetPluginsWithKind(t *testing.T) { assert.Equal(t, 1, len(resp.Plugins)) assert.ElementsMatch(t, []*pluginpb.Plugin{ - &pluginpb.Plugin{ + { Name: "test_plugin", ID: "test-plugin", LatestVersion: "0.0.3", @@ -248,13 +248,13 @@ func TestServer_GetRetentionPluginConfig(t *testing.T) { DefaultExportURL: "http://test-export-url2", AllowCustomExportURL: true, PresetScripts: []*pluginpb.GetRetentionPluginConfigResponse_PresetScript{ - &pluginpb.GetRetentionPluginConfigResponse_PresetScript{ + { Name: "dns data", Description: "This is a script to get dns data", DefaultFrequencyS: 10, Script: "dns script", }, - &pluginpb.GetRetentionPluginConfigResponse_PresetScript{ + { Name: "dns data 2", Description: "This is a script to get dns data 2", DefaultFrequencyS: 20, @@ -281,7 +281,7 @@ func TestServer_GetRetentionPluginsForOrg(t *testing.T) { assert.Equal(t, &pluginpb.GetRetentionPluginsForOrgResponse{ Plugins: []*pluginpb.GetRetentionPluginsForOrgResponse_PluginState{ - &pluginpb.GetRetentionPluginsForOrgResponse_PluginState{ + { Plugin: &pluginpb.Plugin{ Name: "test_plugin", ID: "test-plugin", @@ -412,7 +412,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { Version: &types.StringValue{Value: "0.0.1"}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.3", @@ -422,7 +422,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -431,7 +431,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "another-plugin", Version: "0.0.1", @@ -439,7 +439,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { "abcd": "hello", }, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -450,14 +450,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSCreateRequests: []*cronscriptpb.CreateScriptRequest{ - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig3), FrequencyS: 10, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script 2", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig3), @@ -467,14 +467,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedPluginScripts: []*controllers.RetentionScript{ - &controllers.RetentionScript{ + { ScriptName: "dns data", Description: "This is a script to get dns data", IsPreset: true, PluginID: "another-plugin", ExportURL: "", }, - &controllers.RetentionScript{ + { ScriptName: "dns data 2", Description: "This is a script to get dns data 2", IsPreset: true, @@ -496,7 +496,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { DisablePresets: &types.BoolValue{Value: true}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.3", @@ -506,7 +506,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -515,7 +515,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "another-plugin", Version: "0.0.1", @@ -523,7 +523,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { "abcd": "hello", }, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -534,7 +534,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSCreateRequests: []*cronscriptpb.CreateScriptRequest{ - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig3), @@ -542,7 +542,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { Disabled: true, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script 2", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig3), @@ -552,14 +552,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedPluginScripts: []*controllers.RetentionScript{ - &controllers.RetentionScript{ + { ScriptName: "dns data", Description: "This is a script to get dns data", IsPreset: true, PluginID: "another-plugin", ExportURL: "", }, - &controllers.RetentionScript{ + { ScriptName: "dns data 2", Description: "This is a script to get dns data 2", IsPreset: true, @@ -581,7 +581,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportUrl: &types.StringValue{Value: "https://localhost:8080"}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.3", @@ -591,7 +591,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -600,7 +600,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "another-plugin", Version: "0.0.1", @@ -610,7 +610,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv2, InsecureTLS: false, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -621,14 +621,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSCreateRequests: []*cronscriptpb.CreateScriptRequest{ - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig4), FrequencyS: 10, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script 2", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig4), @@ -638,14 +638,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedPluginScripts: []*controllers.RetentionScript{ - &controllers.RetentionScript{ + { ScriptName: "dns data", Description: "This is a script to get dns data", IsPreset: true, PluginID: "another-plugin", ExportURL: "", }, - &controllers.RetentionScript{ + { ScriptName: "dns data 2", Description: "This is a script to get dns data 2", IsPreset: true, @@ -662,7 +662,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { Enabled: &types.BoolValue{Value: false}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -671,7 +671,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -682,13 +682,13 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSDeleteRequests: []*cronscriptpb.DeleteScriptRequest{ - &cronscriptpb.DeleteScriptRequest{ + { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), }, }, expectedCSUpdateRequests: []*cronscriptpb.UpdateScriptRequest{ - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Enabled: &types.BoolValue{ @@ -707,7 +707,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.3", @@ -717,7 +717,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -726,7 +726,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -737,14 +737,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSUpdateRequests: []*cronscriptpb.UpdateScriptRequest{ - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), Configs: &types.StringValue{ Value: string(mConfig1), }, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), }, - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), Configs: &types.StringValue{ Value: string(mConfig2), @@ -765,7 +765,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { InsecureTLS: &types.BoolValue{Value: true}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.1", @@ -775,7 +775,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: false, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -784,7 +784,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -806,7 +806,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportUrl: &types.StringValue{Value: "https://test:443"}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.3", @@ -816,7 +816,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &newExportURL, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -825,7 +825,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -836,14 +836,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSUpdateRequests: []*cronscriptpb.UpdateScriptRequest{ - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), Configs: &types.StringValue{ Value: string(mConfig1), }, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), }, - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), Configs: &types.StringValue{ Value: string(mConfig2), @@ -860,7 +860,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { Version: &types.StringValue{Value: "0.0.2"}, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.2", @@ -870,7 +870,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -879,7 +879,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -901,7 +901,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.2", @@ -911,7 +911,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -920,7 +920,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.3", @@ -931,14 +931,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSUpdateRequests: []*cronscriptpb.UpdateScriptRequest{ - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), Configs: &types.StringValue{ Value: string(mConfig1), }, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), }, - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), Configs: &types.StringValue{ Value: string(mConfig2), @@ -947,14 +947,14 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSCreateRequests: []*cronscriptpb.CreateScriptRequest{ - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig5), FrequencyS: 10, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), }, - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script 2", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig5), @@ -974,7 +974,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedOrgConfigs: []orgConfig{ - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440000", PluginID: "test-plugin", Version: "0.0.3", @@ -984,7 +984,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { CustomExportURL: &exportURLv3, InsecureTLS: true, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440001", PluginID: "test-plugin", Version: "0.0.2", @@ -993,7 +993,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, CustomExportURL: &exportURLv2, }, - orgConfig{ + { OrgID: "223e4567-e89b-12d3-a456-426655440002", PluginID: "test-plugin", Version: "0.0.2", @@ -1004,28 +1004,28 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSUpdateRequests: []*cronscriptpb.UpdateScriptRequest{ - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440004"), Configs: &types.StringValue{ Value: string(mConfig4), }, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), }, - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440005"), Configs: &types.StringValue{ Value: string(mConfig2TLSFalse), }, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), }, - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440006"), Configs: &types.StringValue{ Value: string(mConfig2TLSFalse), }, OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), }, - &cronscriptpb.UpdateScriptRequest{ + { ScriptId: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440005"), Script: &types.StringValue{ Value: "dns script", @@ -1034,7 +1034,7 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedCSCreateRequests: []*cronscriptpb.CreateScriptRequest{ - &cronscriptpb.CreateScriptRequest{ + { Script: "dns script 2", ClusterIDs: make([]*uuidpb.UUID, 0), Configs: string(mConfig4), @@ -1043,28 +1043,28 @@ func TestServer_UpdateRetentionConfigs(t *testing.T) { }, }, expectedPluginScripts: []*controllers.RetentionScript{ - &controllers.RetentionScript{ + { ScriptName: "testScript", Description: "This is a script", IsPreset: false, PluginID: "test-plugin", ExportURL: "https://localhost:8080", }, - &controllers.RetentionScript{ + { ScriptName: "dns data", Description: "This is a script to get dns data", IsPreset: true, PluginID: "test-plugin", ExportURL: "https://url", }, - &controllers.RetentionScript{ + { ScriptName: "dns data 2", Description: "This is a script to get dns data 2", IsPreset: true, PluginID: "test-plugin", ExportURL: "", }, - &controllers.RetentionScript{ + { ScriptName: "old dns data", Description: "This is another script", IsPreset: false, @@ -1178,7 +1178,7 @@ func TestServer_GetRetentionScripts(t *testing.T) { OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), }).Return(&cronscriptpb.GetScriptsResponse{ Scripts: []*cronscriptpb.CronScript{ - &cronscriptpb.CronScript{ + { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", @@ -1188,7 +1188,7 @@ func TestServer_GetRetentionScripts(t *testing.T) { Enabled: true, FrequencyS: 5, }, - &cronscriptpb.CronScript{ + { ID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "df.stream()", @@ -1210,7 +1210,7 @@ func TestServer_GetRetentionScripts(t *testing.T) { require.NotNil(t, resp) assert.ElementsMatch(t, []*pluginpb.RetentionScript{ - &pluginpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440000"), ScriptName: "testScript", Description: "This is a script", @@ -1222,7 +1222,7 @@ func TestServer_GetRetentionScripts(t *testing.T) { Enabled: true, IsPreset: false, }, - &pluginpb.RetentionScript{ + { ScriptID: utils.ProtoFromUUIDStrOrNil("123e4567-e89b-12d3-a456-426655440001"), ScriptName: "testScript2", Description: "This is another script", diff --git a/src/cloud/plugin/load_db/load_db_test.go b/src/cloud/plugin/load_db/load_db_test.go index 0396f2620a6..7ae605a9efe 100644 --- a/src/cloud/plugin/load_db/load_db_test.go +++ b/src/cloud/plugin/load_db/load_db_test.go @@ -98,35 +98,35 @@ func loadTestData(db *sqlx.DB, pluginVersions map[string][]string, enabledPlugin func TestLoadDB_UpdatePlugins(t *testing.T) { loadTestData(db, map[string][]string{ - "test-plugin": []string{ + "test-plugin": { "0.0.1", "0.0.2", "0.0.3", "0.1.0", "0.1.1", "0.1.2", "1.0.0", "1.1.0", }, - "another-plugin": []string{ + "another-plugin": { "0.0.1", "0.0.2", }, }, map[string][]*enabledPlugin{ - "223e4567-e89b-12d3-a456-426655440000": []*enabledPlugin{ - &enabledPlugin{ + "223e4567-e89b-12d3-a456-426655440000": { + { pluginID: "test-plugin", version: "0.0.3", }, }, - "223e4567-e89b-12d3-a456-426655440001": []*enabledPlugin{ - &enabledPlugin{ + "223e4567-e89b-12d3-a456-426655440001": { + { pluginID: "test-plugin", version: "0.1.2", }, - &enabledPlugin{ + { pluginID: "another-plugin", version: "0.0.1", }, }, - "223e4567-e89b-12d3-a456-426655440002": []*enabledPlugin{ - &enabledPlugin{ + "223e4567-e89b-12d3-a456-426655440002": { + { pluginID: "test-plugin", version: "1.0.0", }, - &enabledPlugin{ + { pluginID: "another-plugin", version: "0.0.2", }, @@ -146,17 +146,17 @@ func TestLoadDB_UpdatePlugins(t *testing.T) { main.UpdatePlugins(db, mockClient) assert.ElementsMatch(t, []*pluginpb.UpdateOrgRetentionPluginConfigRequest{ - &pluginpb.UpdateOrgRetentionPluginConfigRequest{ + { OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Version: &types.StringValue{Value: "0.1.2"}, PluginID: "test-plugin", }, - &pluginpb.UpdateOrgRetentionPluginConfigRequest{ + { OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Version: &types.StringValue{Value: "0.0.2"}, PluginID: "another-plugin", }, - &pluginpb.UpdateOrgRetentionPluginConfigRequest{ + { OrgID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), Version: &types.StringValue{Value: "1.1.0"}, PluginID: "test-plugin", diff --git a/src/cloud/profile/controllers/server_test.go b/src/cloud/profile/controllers/server_test.go index 5c7df3d1207..76894fa201b 100644 --- a/src/cloud/profile/controllers/server_test.go +++ b/src/cloud/profile/controllers/server_test.go @@ -1666,7 +1666,7 @@ func TestServer_GetOrgIDEConfigs_Single(t *testing.T) { require.NoError(t, err) assert.Equal(t, &profilepb.GetOrgIDEConfigsResponse{ Configs: []*profilepb.IDEConfig{ - &profilepb.IDEConfig{ + { IDEName: "test", Path: "test://{{symbol}}", }, @@ -1691,11 +1691,11 @@ func TestServer_GetOrgIDEConfigs_Multi(t *testing.T) { osds.EXPECT(). GetIDEConfigs(orgID). Return([]*datastore.IDEConfig{ - &datastore.IDEConfig{ + { Name: "test", Path: "test://{{symbol}}", }, - &datastore.IDEConfig{ + { Name: "test2", Path: "test2://{{symbol2}}", }, @@ -1707,11 +1707,11 @@ func TestServer_GetOrgIDEConfigs_Multi(t *testing.T) { require.NoError(t, err) assert.Equal(t, &profilepb.GetOrgIDEConfigsResponse{ Configs: []*profilepb.IDEConfig{ - &profilepb.IDEConfig{ + { IDEName: "test", Path: "test://{{symbol}}", }, - &profilepb.IDEConfig{ + { IDEName: "test2", Path: "test2://{{symbol2}}", }, diff --git a/src/operator/controllers/monitor_test.go b/src/operator/controllers/monitor_test.go index 9aaf1ad86c4..f6be803fa33 100644 --- a/src/operator/controllers/monitor_test.go +++ b/src/operator/controllers/monitor_test.go @@ -115,9 +115,9 @@ func TestMonitor_queryPodStatusz(t *testing.T) { }, Spec: v1.PodSpec{ Containers: []v1.Container{ - v1.Container{ + { Ports: []v1.ContainerPort{ - v1.ContainerPort{ + { ContainerPort: test.podPort, }, }, @@ -183,9 +183,9 @@ func TestMonitor_getCloudConnState(t *testing.T) { }, Spec: v1.PodSpec{ Containers: []v1.Container{ - v1.Container{ + { Ports: []v1.ContainerPort{ - v1.ContainerPort{ + { ContainerPort: 8080, }, }, @@ -354,9 +354,9 @@ func TestMonitor_getCloudConnState_SeveralCloudConns(t *testing.T) { spec := v1.PodSpec{ Containers: []v1.Container{ - v1.Container{ + { Ports: []v1.ContainerPort{ - v1.ContainerPort{ + { ContainerPort: 8080, }, }, @@ -613,7 +613,7 @@ func TestMonitor_getControlPlanePodState(t *testing.T) { phase: v1.PodPending, plane: "control", conditions: []v1.PodCondition{ - v1.PodCondition{ + { Type: v1.PodScheduled, Status: v1.ConditionFalse, Reason: v1.PodReasonUnschedulable, @@ -632,7 +632,7 @@ func TestMonitor_getControlPlanePodState(t *testing.T) { phase: v1.PodPending, plane: "control", conditions: []v1.PodCondition{ - v1.PodCondition{ + { Type: v1.PodScheduled, Status: v1.ConditionFalse, Reason: v1.PodReasonUnschedulable, @@ -673,11 +673,11 @@ func TestMonitor_getControlPlanePodState(t *testing.T) { } var healthyConditions = []v1.PodCondition{ - v1.PodCondition{ + { Type: v1.PodReady, Status: v1.ConditionTrue, }, - v1.PodCondition{ + { Type: v1.PodScheduled, Status: v1.ConditionTrue, }, @@ -779,7 +779,7 @@ func TestMonitor_getPEMsSomeInsufficientMemory(t *testing.T) { name: "vizier-pem-abcdefg", phase: v1.PodPending, conditions: []v1.PodCondition{ - v1.PodCondition{ + { Reason: "FailedScheduling", Message: "foo", }, @@ -1055,7 +1055,7 @@ func TestMonitor_getPEMCrashingState(t *testing.T) { Status: v1.PodStatus{ Phase: p.phase, ContainerStatuses: []v1.ContainerStatus{ - v1.ContainerStatus{ + { Name: "pem", State: p.containerState, }, diff --git a/src/pixie_cli/pkg/vizier/utils.go b/src/pixie_cli/pkg/vizier/utils.go index c8727dae480..5078cb5de93 100644 --- a/src/pixie_cli/pkg/vizier/utils.go +++ b/src/pixie_cli/pkg/vizier/utils.go @@ -56,7 +56,7 @@ func FindVizierNamespace(clientset *kubernetes.Clientset) (string, error) { func FindOperatorNamespace(clientset *kubernetes.Clientset) (string, error) { labelSelector := metav1.FormatLabelSelector(&metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ - metav1.LabelSelectorRequirement{ + { Key: "app", Operator: metav1.LabelSelectorOpIn, Values: []string{"pixie-operator"}, diff --git a/src/shared/scripts/cron_script_test.go b/src/shared/scripts/cron_script_test.go index 5db8da2b840..75207e20afb 100644 --- a/src/shared/scripts/cron_script_test.go +++ b/src/shared/scripts/cron_script_test.go @@ -51,7 +51,7 @@ func TestCronScript_GetChecksum(t *testing.T) { { name: "one empty", mapA: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 10, Configs: "test", @@ -64,19 +64,19 @@ func TestCronScript_GetChecksum(t *testing.T) { { name: "matching", mapA: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 10, Configs: "test", ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - "323e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "323e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 100, Configs: "config 2", ID: utils.ProtoFromUUIDStrOrNil("323e4567-e89b-12d3-a456-426655440001"), }, - "423e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "423e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 2, Configs: "config 3", @@ -84,19 +84,19 @@ func TestCronScript_GetChecksum(t *testing.T) { }, }, mapB: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 10, Configs: "test", ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - "423e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "423e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 2, Configs: "config 3", ID: utils.ProtoFromUUIDStrOrNil("423e4567-e89b-12d3-a456-426655440001"), }, - "323e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "323e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 100, Configs: "config 2", @@ -108,19 +108,19 @@ func TestCronScript_GetChecksum(t *testing.T) { { name: "slight mismatch", mapA: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 10, Configs: "test", ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - "323e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "323e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 100, Configs: "config 2", ID: utils.ProtoFromUUIDStrOrNil("323e4567-e89b-12d3-a456-426655440001"), }, - "423e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "423e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 2, Configs: "config 3", @@ -128,19 +128,19 @@ func TestCronScript_GetChecksum(t *testing.T) { }, }, mapB: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 11, Configs: "test", ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), }, - "423e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "423e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 2, Configs: "config 3", ID: utils.ProtoFromUUIDStrOrNil("423e4567-e89b-12d3-a456-426655440001"), }, - "323e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "323e4567-e89b-12d3-a456-426655440001": { Script: "px.display()", FrequencyS: 100, Configs: "config 2", diff --git a/src/utils/pixie_deleter/main.go b/src/utils/pixie_deleter/main.go index 8742d9704a7..50a87fd32d1 100644 --- a/src/utils/pixie_deleter/main.go +++ b/src/utils/pixie_deleter/main.go @@ -62,12 +62,12 @@ func main() { // First delete non-bootstrap items. For example, avoid clusterrole objects as these may prevent following deletes from going through. vzNameLabelSelector := metav1.FormatLabelSelector(&metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ - metav1.LabelSelectorRequirement{ + { Key: "vizier-name", Operator: metav1.LabelSelectorOpIn, Values: []string{vzName}, }, - metav1.LabelSelectorRequirement{ + { Key: "vizier-bootstrap", Operator: metav1.LabelSelectorOpNotIn, Values: []string{"true"}, @@ -80,7 +80,7 @@ func main() { // Delete clusterrole objects. labelSelector := metav1.FormatLabelSelector(&metav1.LabelSelector{ MatchExpressions: []metav1.LabelSelectorRequirement{ - metav1.LabelSelectorRequirement{ + { Key: "vizier-name", Operator: metav1.LabelSelectorOpIn, Values: []string{vzName}, diff --git a/src/utils/shared/k8s/selector.go b/src/utils/shared/k8s/selector.go index b4e729e7399..15df3b02c8e 100644 --- a/src/utils/shared/k8s/selector.go +++ b/src/utils/shared/k8s/selector.go @@ -27,7 +27,7 @@ func VizierLabelSelector() metav1.LabelSelector { return metav1.LabelSelector{ MatchLabels: make(map[string]string), MatchExpressions: []metav1.LabelSelectorRequirement{ - metav1.LabelSelectorRequirement{ + { Key: "app", Operator: metav1.LabelSelectorOpIn, Values: []string{"pixie-operator", "pl-monitoring"}, @@ -42,7 +42,7 @@ func OperatorLabelSelector() metav1.LabelSelector { return metav1.LabelSelector{ MatchLabels: make(map[string]string), MatchExpressions: []metav1.LabelSelectorRequirement{ - metav1.LabelSelectorRequirement{ + { Key: "olm.catalogSource", Operator: metav1.LabelSelectorOpIn, Values: []string{"pixie-operator-index"}, diff --git a/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler.go b/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler.go index d350a2d751d..d6754202722 100644 --- a/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler.go +++ b/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler.go @@ -602,7 +602,7 @@ func (p *ServiceUpdateProcessor) GetUpdatesToSend(storedUpdates []*StoredUpdate, // Service updates will also be sent to PEMs by the EndpointsUpdateProcessor in order to provide // a mapping from service->pod. return []*OutgoingUpdate{ - &OutgoingUpdate{ + { Update: &metadatapb.ResourceUpdate{ UpdateVersion: uv, Update: &metadatapb.ResourceUpdate_ServiceUpdate{ diff --git a/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler_test.go b/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler_test.go index 8f12fd7ff36..2ef4e978dae 100644 --- a/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler_test.go +++ b/src/vizier/services/metadata/controllers/k8smeta/k8s_metadata_handler_test.go @@ -1048,7 +1048,7 @@ func TestPodUpdateProcessor_GetUpdatesToSend(t *testing.T) { Message: "this is message", Reason: "this is reason", OwnerReferences: []*metadatapb.OwnerReference{ - &metadatapb.OwnerReference{ + { Kind: "pod", Name: "test", UID: "abcd", diff --git a/src/vizier/services/query_broker/controllers/query_executor.go b/src/vizier/services/query_broker/controllers/query_executor.go index cb7a2d98f86..a15b5cdbce9 100644 --- a/src/vizier/services/query_broker/controllers/query_executor.go +++ b/src/vizier/services/query_broker/controllers/query_executor.go @@ -335,7 +335,7 @@ func (q *QueryExecutorImpl) compilePlan(ctx context.Context, resultCh chan<- *vi debugInfo := &distributedpb.DebugInfo{ OtelDebugAttributes: []*distributedpb.DebugInfo_OTelDebugAttribute{ - &distributedpb.DebugInfo_OTelDebugAttribute{ + { Name: "px.cloud.address", Value: viper.GetString("cloud_addr"), }, diff --git a/src/vizier/services/query_broker/controllers/query_executor_test.go b/src/vizier/services/query_broker/controllers/query_executor_test.go index 6e5bea3b609..1522e0c262a 100644 --- a/src/vizier/services/query_broker/controllers/query_executor_test.go +++ b/src/vizier/services/query_broker/controllers/query_executor_test.go @@ -535,7 +535,7 @@ func buildPlannerErrorTestCase(t *testing.T) queryExecTestCase { Code: int32(statuspb.INVALID_ARGUMENT), Message: "", ErrorDetails: []*vizierpb.ErrorDetails{ - &vizierpb.ErrorDetails{ + { Error: &vizierpb.ErrorDetails_CompilerError{ CompilerError: &vizierpb.CompilerError{ Line: 1, @@ -544,7 +544,7 @@ func buildPlannerErrorTestCase(t *testing.T) queryExecTestCase { }, }, }, - &vizierpb.ErrorDetails{ + { Error: &vizierpb.ErrorDetails_CompilerError{ CompilerError: &vizierpb.CompilerError{ Line: 20, @@ -600,7 +600,7 @@ func buildPlanInvalidUUIDTestCase(t *testing.T) queryExecTestCase { Status: &statuspb.Status{ErrCode: statuspb.OK}, Plan: &distributedpb.DistributedPlan{ QbAddressToPlan: map[string]*planpb.Plan{ - "not a uuid": &planpb.Plan{}, + "not a uuid": {}, }, }, } @@ -631,8 +631,8 @@ func buildConsumeErrorTestCase(t *testing.T) queryExecTestCase { }, ResultForwarderResps: []*vizierpb.ExecuteScriptResponse{ // These responses should not be received by the consumer. - &vizierpb.ExecuteScriptResponse{}, - &vizierpb.ExecuteScriptResponse{}, + {}, + {}, }, ExpectedResps: []*vizierpb.ExecuteScriptResponse{}, TableNames: []string{"agent1_table", "agent2_table"}, @@ -757,7 +757,7 @@ func buildResumeQueryBadQueryIDTestCase(t *testing.T) queryExecTestCase { }, ResultForwarderResps: []*vizierpb.ExecuteScriptResponse{ // This should not be sent. - &vizierpb.ExecuteScriptResponse{}, + {}, }, ExpectedResps: []*vizierpb.ExecuteScriptResponse{}, // Resuming should not send table relation responses again. @@ -795,7 +795,7 @@ func buildMutationFailedQueryTestCase(t *testing.T) queryExecTestCase { }, ResultForwarderResps: []*vizierpb.ExecuteScriptResponse{}, ExpectedResps: []*vizierpb.ExecuteScriptResponse{ - &vizierpb.ExecuteScriptResponse{ + { Status: &vizierpb.Status{Code: 0}, MutationInfo: mutInfo, }, diff --git a/src/vizier/services/query_broker/script_runner/script_runner_test.go b/src/vizier/services/query_broker/script_runner/script_runner_test.go index fad2ad55deb..ad065855fa9 100644 --- a/src/vizier/services/query_broker/script_runner/script_runner_test.go +++ b/src/vizier/services/query_broker/script_runner/script_runner_test.go @@ -56,13 +56,13 @@ func TestScriptRunner_CompareScriptState(t *testing.T) { { name: "checksums match", persistedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -70,13 +70,13 @@ func TestScriptRunner_CompareScriptState(t *testing.T) { }, }, cloudScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -88,13 +88,13 @@ func TestScriptRunner_CompareScriptState(t *testing.T) { { name: "checksums mismatch: one field different", persistedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -102,13 +102,13 @@ func TestScriptRunner_CompareScriptState(t *testing.T) { }, }, cloudScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 6, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -120,13 +120,13 @@ func TestScriptRunner_CompareScriptState(t *testing.T) { { name: "checksums mismatch: missing script", persistedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -134,7 +134,7 @@ func TestScriptRunner_CompareScriptState(t *testing.T) { }, }, cloudScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", @@ -205,13 +205,13 @@ func TestScriptRunner_GetCloudScripts(t *testing.T) { require.NoError(t, err) scripts := map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -320,13 +320,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { { name: "initial match", persistedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -334,13 +334,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, cloudScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -348,7 +348,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, updates: []*cvmsgspb.CronScriptUpdate{ - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -362,7 +362,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "1", Timestamp: 1, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_DeleteReq{ DeleteReq: &cvmsgspb.DeleteCronScriptRequest{ ScriptID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), @@ -373,13 +373,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, expectedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440002": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440002": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), Script: "test script 2", Configs: "config3", @@ -390,13 +390,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { { name: "initial mismatch", persistedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440000": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440000": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440000"), Script: "px.display()", Configs: "config1", FrequencyS: 5, }, - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -404,7 +404,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, cloudScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -412,7 +412,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, updates: []*cvmsgspb.CronScriptUpdate{ - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -426,7 +426,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "1", Timestamp: 1, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_DeleteReq{ DeleteReq: &cvmsgspb.DeleteCronScriptRequest{ ScriptID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), @@ -437,7 +437,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, expectedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440002": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440002": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), Script: "test script 2", Configs: "config3", @@ -449,7 +449,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { name: "persisted empty", persistedScripts: map[string]*cvmsgspb.CronScript{}, cloudScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", @@ -457,7 +457,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, updates: []*cvmsgspb.CronScriptUpdate{ - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -471,7 +471,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "1", Timestamp: 1, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_DeleteReq{ DeleteReq: &cvmsgspb.DeleteCronScriptRequest{ ScriptID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440003"), @@ -482,13 +482,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, expectedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440001": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440001": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440001"), Script: "test script", Configs: "config2", FrequencyS: 22, }, - "223e4567-e89b-12d3-a456-426655440002": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440002": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), Script: "test script 2", Configs: "config3", @@ -501,7 +501,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { persistedScripts: map[string]*cvmsgspb.CronScript{}, cloudScripts: map[string]*cvmsgspb.CronScript{}, updates: []*cvmsgspb.CronScriptUpdate{ - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -515,7 +515,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "1", Timestamp: 1, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -529,7 +529,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "2", Timestamp: 2, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -543,7 +543,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "3", Timestamp: 3, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_DeleteReq{ DeleteReq: &cvmsgspb.DeleteCronScriptRequest{ ScriptID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440003"), @@ -554,13 +554,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, expectedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440002": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440002": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), Script: "test script 2", Configs: "config3", FrequencyS: 123, }, - "223e4567-e89b-12d3-a456-426655440004": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440004": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440004"), Script: "test script 2", Configs: "config3", @@ -573,7 +573,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { persistedScripts: map[string]*cvmsgspb.CronScript{}, cloudScripts: map[string]*cvmsgspb.CronScript{}, updates: []*cvmsgspb.CronScriptUpdate{ - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -587,7 +587,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "1", Timestamp: 1, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -601,7 +601,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "2", Timestamp: 2, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -615,7 +615,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "3", Timestamp: 3, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_DeleteReq{ DeleteReq: &cvmsgspb.DeleteCronScriptRequest{ ScriptID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440003"), @@ -624,7 +624,7 @@ func TestScriptRunner_SyncScripts(t *testing.T) { RequestID: "4", Timestamp: 4, }, - &cvmsgspb.CronScriptUpdate{ + { Msg: &cvmsgspb.CronScriptUpdate_UpsertReq{ UpsertReq: &cvmsgspb.RegisterOrUpdateCronScriptRequest{ Script: &cvmsgspb.CronScript{ @@ -640,13 +640,13 @@ func TestScriptRunner_SyncScripts(t *testing.T) { }, }, expectedScripts: map[string]*cvmsgspb.CronScript{ - "223e4567-e89b-12d3-a456-426655440002": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440002": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440002"), Script: "test script 2", Configs: "config3", FrequencyS: 123, }, - "223e4567-e89b-12d3-a456-426655440004": &cvmsgspb.CronScript{ + "223e4567-e89b-12d3-a456-426655440004": { ID: utils.ProtoFromUUIDStrOrNil("223e4567-e89b-12d3-a456-426655440004"), Script: "test script 2", Configs: "config3", @@ -819,7 +819,7 @@ func TestScriptRunner_StoreResults(t *testing.T) { { name: "forwards exec stats", execScriptResponses: []*vizierpb.ExecuteScriptResponse{ - &vizierpb.ExecuteScriptResponse{ + { Result: &vizierpb.ExecuteScriptResponse_Data{ Data: &vizierpb.QueryData{ ExecutionStats: &vizierpb.QueryExecutionStats{ @@ -848,7 +848,7 @@ func TestScriptRunner_StoreResults(t *testing.T) { { name: "handles non-compiler error", execScriptResponses: []*vizierpb.ExecuteScriptResponse{ - &vizierpb.ExecuteScriptResponse{ + { Status: &vizierpb.Status{ Code: 3, // INVALID_ARGUMENT Message: "Invalid", @@ -867,7 +867,7 @@ func TestScriptRunner_StoreResults(t *testing.T) { { name: "handles compiler error", execScriptResponses: []*vizierpb.ExecuteScriptResponse{ - &vizierpb.ExecuteScriptResponse{ + { Status: &vizierpb.Status{ Code: 3, // INVALID_ARGUMENT ErrorDetails: []*vizierpb.ErrorDetails{