From 403442238bdf810b36af27ef707610ffe188aade Mon Sep 17 00:00:00 2001 From: James Pickett Date: Thu, 15 Aug 2024 11:06:04 -0700 Subject: [PATCH 1/3] implement recheck cmd --- cmd/launcher/main.go | 2 + cmd/launcher/recheck.go | 45 +++ ee/agent/flags/flag_controller.go | 7 + ee/agent/flags/keys/keys.go | 1 + ee/agent/startupsettings/writer.go | 2 + ee/agent/types/flags.go | 4 + ee/agent/types/mocks/flags.go | 418 ++++++++++++++++++- ee/agent/types/mocks/knapsack.go | 507 +++++++++++++++++++++++- ee/desktop/runner/runner.go | 19 + ee/desktop/runner/server/server.go | 41 +- ee/desktop/runner/server/server_test.go | 7 + 11 files changed, 1041 insertions(+), 12 deletions(-) create mode 100644 cmd/launcher/recheck.go diff --git a/cmd/launcher/main.go b/cmd/launcher/main.go index a8eaf0818..4c98f3975 100644 --- a/cmd/launcher/main.go +++ b/cmd/launcher/main.go @@ -196,6 +196,8 @@ func runSubcommands(systemMultiSlogger *multislogger.MultiSlogger) error { run = runSecureEnclave case "watchdog": // note: this is currently only implemented for windows run = watchdog.RunWatchdogService + case "recheck": + run = runRecheck default: return fmt.Errorf("unknown subcommand %s", os.Args[1]) } diff --git a/cmd/launcher/recheck.go b/cmd/launcher/recheck.go new file mode 100644 index 000000000..69cef9750 --- /dev/null +++ b/cmd/launcher/recheck.go @@ -0,0 +1,45 @@ +package main + +import ( + "context" + "fmt" + "net/http" + + "github.com/kolide/launcher/ee/agent/flags/keys" + "github.com/kolide/launcher/ee/agent/startupsettings" + "github.com/kolide/launcher/pkg/launcher" + "github.com/kolide/launcher/pkg/log/multislogger" +) + +func runRecheck(_ *multislogger.MultiSlogger, _ []string) error { + attachConsole() + defer detachConsole() + + settingReader, err := startupsettings.OpenReader(context.TODO(), launcher.DefaultPath(launcher.RootDirectory)) + if err != nil { + return fmt.Errorf("opening startup settings reader to fetch desktop runner server url, is launcher daemon running?: %w", err) + } + defer settingReader.Close() + + desktopRunnerServerURL, err := settingReader.Get(keys.DesktopRunnerServerUrl.String()) + if err != nil { + return fmt.Errorf("getting desktop runner server url, is launcher daemon running?: %w", err) + } + + response, err := http.Get(fmt.Sprintf("%s/recheck", desktopRunnerServerURL)) + if err != nil { + return fmt.Errorf("sending recheck request to desktop runner server, is launcher daemon running?: %w", err) + } + + if response.Body != nil { + defer response.Body.Close() + } + + if response.StatusCode != http.StatusOK { + return fmt.Errorf("recheck request failed with status code %d", response.StatusCode) + } + + fmt.Print("recheck request sent successfully") + + return nil +} diff --git a/ee/agent/flags/flag_controller.go b/ee/agent/flags/flag_controller.go index 23b659db1..3c8c5eb6b 100644 --- a/ee/agent/flags/flag_controller.go +++ b/ee/agent/flags/flag_controller.go @@ -647,3 +647,10 @@ func (fc *FlagController) LocalDevelopmentPath() string { WithDefaultString(fc.cmdLineOpts.LocalDevelopmentPath), ).get(nil) } + +func (fc *FlagController) SetDesktopRunnerServerURL(url string) error { + return fc.setControlServerValue(keys.DesktopRunnerServerUrl, []byte(url)) +} +func (fc *FlagController) DesktopRunnerServerURL() string { + return NewStringFlagValue().get(fc.getControlServerValue(keys.DesktopRunnerServerUrl)) +} diff --git a/ee/agent/flags/keys/keys.go b/ee/agent/flags/keys/keys.go index 1af492ea9..2a772c072 100644 --- a/ee/agent/flags/keys/keys.go +++ b/ee/agent/flags/keys/keys.go @@ -56,6 +56,7 @@ const ( InModernStandby FlagKey = "in_modern_standby" LocalDevelopmentPath FlagKey = "localdev_path" LauncherWatchdogEnabled FlagKey = "launcher_watchdog_enabled" // note that this will only impact windows deployments for now + DesktopRunnerServerUrl FlagKey = "desktop_runner_server_url" ) func (key FlagKey) String() string { diff --git a/ee/agent/startupsettings/writer.go b/ee/agent/startupsettings/writer.go index e70b9e453..240e6fc6e 100644 --- a/ee/agent/startupsettings/writer.go +++ b/ee/agent/startupsettings/writer.go @@ -70,6 +70,8 @@ func (s *startupSettingsWriter) WriteSettings() error { } updatedFlags["use_tuf_autoupdater"] = "enabled" // Hardcode for backwards compatibility circa v1.5.3 + updatedFlags[keys.DesktopRunnerServerUrl.String()] = s.knapsack.DesktopRunnerServerURL() + atcConfig, err := s.extractAutoTableConstructionConfig() if err != nil { s.knapsack.Slogger().Log(context.TODO(), slog.LevelDebug, diff --git a/ee/agent/types/flags.go b/ee/agent/types/flags.go index 94bfc23fa..f4a7baa97 100644 --- a/ee/agent/types/flags.go +++ b/ee/agent/types/flags.go @@ -226,4 +226,8 @@ type Flags interface { // LauncherWatchdogEnabled controls whether launcher installs/runs, or stops/removes the launcher watchdog service SetLauncherWatchdogEnabled(enabled bool) error LauncherWatchdogEnabled() bool + + // DesktopRunnerServerURL is the URL of the desktop runner server + SetDesktopRunnerServerURL(url string) error + DesktopRunnerServerURL() string } diff --git a/ee/agent/types/mocks/flags.go b/ee/agent/types/mocks/flags.go index 25be2d780..ed62bcd17 100644 --- a/ee/agent/types/mocks/flags.go +++ b/ee/agent/types/mocks/flags.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.34.2. DO NOT EDIT. +// Code generated by mockery v2.44.1. DO NOT EDIT. package mocks @@ -20,6 +20,10 @@ type Flags struct { func (_m *Flags) Autoupdate() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Autoupdate") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -34,6 +38,10 @@ func (_m *Flags) Autoupdate() bool { func (_m *Flags) AutoupdateInitialDelay() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AutoupdateInitialDelay") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -48,6 +56,10 @@ func (_m *Flags) AutoupdateInitialDelay() time.Duration { func (_m *Flags) AutoupdateInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AutoupdateInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -62,6 +74,10 @@ func (_m *Flags) AutoupdateInterval() time.Duration { func (_m *Flags) CertPins() [][]byte { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CertPins") + } + var r0 [][]byte if rf, ok := ret.Get(0).(func() [][]byte); ok { r0 = rf() @@ -78,6 +94,10 @@ func (_m *Flags) CertPins() [][]byte { func (_m *Flags) ControlRequestInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ControlRequestInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -92,6 +112,10 @@ func (_m *Flags) ControlRequestInterval() time.Duration { func (_m *Flags) ControlServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ControlServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -106,6 +130,10 @@ func (_m *Flags) ControlServerURL() string { func (_m *Flags) Debug() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Debug") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -120,6 +148,10 @@ func (_m *Flags) Debug() bool { func (_m *Flags) DebugLogFile() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DebugLogFile") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -134,6 +166,10 @@ func (_m *Flags) DebugLogFile() string { func (_m *Flags) DebugServerData() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DebugServerData") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -148,6 +184,10 @@ func (_m *Flags) DebugServerData() bool { func (_m *Flags) DesktopEnabled() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DesktopEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -162,6 +202,10 @@ func (_m *Flags) DesktopEnabled() bool { func (_m *Flags) DesktopMenuRefreshInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DesktopMenuRefreshInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -172,10 +216,32 @@ func (_m *Flags) DesktopMenuRefreshInterval() time.Duration { return r0 } +// DesktopRunnerServerURL provides a mock function with given fields: +func (_m *Flags) DesktopRunnerServerURL() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for DesktopRunnerServerURL") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // DesktopUpdateInterval provides a mock function with given fields: func (_m *Flags) DesktopUpdateInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DesktopUpdateInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -190,6 +256,10 @@ func (_m *Flags) DesktopUpdateInterval() time.Duration { func (_m *Flags) DisableControlTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DisableControlTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -204,6 +274,10 @@ func (_m *Flags) DisableControlTLS() bool { func (_m *Flags) DisableTraceIngestTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DisableTraceIngestTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -218,6 +292,10 @@ func (_m *Flags) DisableTraceIngestTLS() bool { func (_m *Flags) EnableInitialRunner() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for EnableInitialRunner") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -232,6 +310,10 @@ func (_m *Flags) EnableInitialRunner() bool { func (_m *Flags) EnrollSecret() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for EnrollSecret") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -246,6 +328,10 @@ func (_m *Flags) EnrollSecret() string { func (_m *Flags) EnrollSecretPath() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for EnrollSecretPath") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -260,6 +346,10 @@ func (_m *Flags) EnrollSecretPath() string { func (_m *Flags) ExportTraces() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ExportTraces") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -274,6 +364,10 @@ func (_m *Flags) ExportTraces() bool { func (_m *Flags) ForceControlSubsystems() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ForceControlSubsystems") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -288,6 +382,10 @@ func (_m *Flags) ForceControlSubsystems() bool { func (_m *Flags) IAmBreakingEELicense() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IAmBreakingEELicense") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -302,6 +400,10 @@ func (_m *Flags) IAmBreakingEELicense() bool { func (_m *Flags) InModernStandby() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InModernStandby") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -316,6 +418,10 @@ func (_m *Flags) InModernStandby() bool { func (_m *Flags) InsecureControlTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InsecureControlTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -330,6 +436,10 @@ func (_m *Flags) InsecureControlTLS() bool { func (_m *Flags) InsecureTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InsecureTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -344,6 +454,10 @@ func (_m *Flags) InsecureTLS() bool { func (_m *Flags) InsecureTransportTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InsecureTransportTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -358,6 +472,10 @@ func (_m *Flags) InsecureTransportTLS() bool { func (_m *Flags) KolideHosted() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for KolideHosted") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -372,6 +490,10 @@ func (_m *Flags) KolideHosted() bool { func (_m *Flags) KolideServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for KolideServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -386,6 +508,10 @@ func (_m *Flags) KolideServerURL() string { func (_m *Flags) LauncherWatchdogEnabled() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LauncherWatchdogEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -400,6 +526,10 @@ func (_m *Flags) LauncherWatchdogEnabled() bool { func (_m *Flags) LocalDevelopmentPath() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LocalDevelopmentPath") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -414,6 +544,10 @@ func (_m *Flags) LocalDevelopmentPath() string { func (_m *Flags) LogIngestServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LogIngestServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -428,6 +562,10 @@ func (_m *Flags) LogIngestServerURL() string { func (_m *Flags) LogMaxBytesPerBatch() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LogMaxBytesPerBatch") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -442,6 +580,10 @@ func (_m *Flags) LogMaxBytesPerBatch() int { func (_m *Flags) LogShippingLevel() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LogShippingLevel") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -456,6 +598,10 @@ func (_m *Flags) LogShippingLevel() string { func (_m *Flags) LoggingInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LoggingInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -470,6 +616,10 @@ func (_m *Flags) LoggingInterval() time.Duration { func (_m *Flags) MirrorServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for MirrorServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -484,6 +634,10 @@ func (_m *Flags) MirrorServerURL() string { func (_m *Flags) OsqueryFlags() []string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryFlags") + } + var r0 []string if rf, ok := ret.Get(0).(func() []string); ok { r0 = rf() @@ -500,6 +654,10 @@ func (_m *Flags) OsqueryFlags() []string { func (_m *Flags) OsqueryHealthcheckStartupDelay() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryHealthcheckStartupDelay") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -514,6 +672,10 @@ func (_m *Flags) OsqueryHealthcheckStartupDelay() time.Duration { func (_m *Flags) OsqueryTlsConfigEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsConfigEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -528,6 +690,10 @@ func (_m *Flags) OsqueryTlsConfigEndpoint() string { func (_m *Flags) OsqueryTlsDistributedReadEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsDistributedReadEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -542,6 +708,10 @@ func (_m *Flags) OsqueryTlsDistributedReadEndpoint() string { func (_m *Flags) OsqueryTlsDistributedWriteEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsDistributedWriteEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -556,6 +726,10 @@ func (_m *Flags) OsqueryTlsDistributedWriteEndpoint() string { func (_m *Flags) OsqueryTlsEnrollEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsEnrollEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -570,6 +744,10 @@ func (_m *Flags) OsqueryTlsEnrollEndpoint() string { func (_m *Flags) OsqueryTlsLoggerEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsLoggerEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -584,6 +762,10 @@ func (_m *Flags) OsqueryTlsLoggerEndpoint() string { func (_m *Flags) OsqueryVerbose() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryVerbose") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -598,6 +780,10 @@ func (_m *Flags) OsqueryVerbose() bool { func (_m *Flags) OsquerydPath() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsquerydPath") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -612,6 +798,10 @@ func (_m *Flags) OsquerydPath() string { func (_m *Flags) PinnedLauncherVersion() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PinnedLauncherVersion") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -626,6 +816,10 @@ func (_m *Flags) PinnedLauncherVersion() string { func (_m *Flags) PinnedOsquerydVersion() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PinnedOsquerydVersion") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -652,6 +846,10 @@ func (_m *Flags) RegisterChangeObserver(observer types.FlagsChangeObserver, flag func (_m *Flags) RootDirectory() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for RootDirectory") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -666,6 +864,10 @@ func (_m *Flags) RootDirectory() string { func (_m *Flags) RootPEM() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for RootPEM") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -680,6 +882,10 @@ func (_m *Flags) RootPEM() string { func (_m *Flags) SetAutoupdate(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetAutoupdate") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -694,6 +900,10 @@ func (_m *Flags) SetAutoupdate(enabled bool) error { func (_m *Flags) SetAutoupdateInitialDelay(delay time.Duration) error { ret := _m.Called(delay) + if len(ret) == 0 { + panic("no return value specified for SetAutoupdateInitialDelay") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(delay) @@ -708,6 +918,10 @@ func (_m *Flags) SetAutoupdateInitialDelay(delay time.Duration) error { func (_m *Flags) SetAutoupdateInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetAutoupdateInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -722,6 +936,10 @@ func (_m *Flags) SetAutoupdateInterval(interval time.Duration) error { func (_m *Flags) SetControlRequestInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetControlRequestInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -741,6 +959,10 @@ func (_m *Flags) SetControlRequestIntervalOverride(value time.Duration, duration func (_m *Flags) SetControlServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetControlServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -755,6 +977,10 @@ func (_m *Flags) SetControlServerURL(url string) error { func (_m *Flags) SetDebug(debug bool) error { ret := _m.Called(debug) + if len(ret) == 0 { + panic("no return value specified for SetDebug") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(debug) @@ -769,6 +995,10 @@ func (_m *Flags) SetDebug(debug bool) error { func (_m *Flags) SetDebugServerData(debug bool) error { ret := _m.Called(debug) + if len(ret) == 0 { + panic("no return value specified for SetDebugServerData") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(debug) @@ -783,6 +1013,10 @@ func (_m *Flags) SetDebugServerData(debug bool) error { func (_m *Flags) SetDesktopEnabled(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetDesktopEnabled") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -797,6 +1031,10 @@ func (_m *Flags) SetDesktopEnabled(enabled bool) error { func (_m *Flags) SetDesktopMenuRefreshInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetDesktopMenuRefreshInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -807,10 +1045,32 @@ func (_m *Flags) SetDesktopMenuRefreshInterval(interval time.Duration) error { return r0 } +// SetDesktopRunnerServerURL provides a mock function with given fields: url +func (_m *Flags) SetDesktopRunnerServerURL(url string) error { + ret := _m.Called(url) + + if len(ret) == 0 { + panic("no return value specified for SetDesktopRunnerServerURL") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(url) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // SetDesktopUpdateInterval provides a mock function with given fields: interval func (_m *Flags) SetDesktopUpdateInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetDesktopUpdateInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -825,6 +1085,10 @@ func (_m *Flags) SetDesktopUpdateInterval(interval time.Duration) error { func (_m *Flags) SetDisableControlTLS(disabled bool) error { ret := _m.Called(disabled) + if len(ret) == 0 { + panic("no return value specified for SetDisableControlTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(disabled) @@ -839,6 +1103,10 @@ func (_m *Flags) SetDisableControlTLS(disabled bool) error { func (_m *Flags) SetDisableTraceIngestTLS(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetDisableTraceIngestTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -853,6 +1121,10 @@ func (_m *Flags) SetDisableTraceIngestTLS(enabled bool) error { func (_m *Flags) SetExportTraces(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetExportTraces") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -872,6 +1144,10 @@ func (_m *Flags) SetExportTracesOverride(value bool, duration time.Duration) { func (_m *Flags) SetForceControlSubsystems(force bool) error { ret := _m.Called(force) + if len(ret) == 0 { + panic("no return value specified for SetForceControlSubsystems") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(force) @@ -886,6 +1162,10 @@ func (_m *Flags) SetForceControlSubsystems(force bool) error { func (_m *Flags) SetInModernStandby(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetInModernStandby") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -900,6 +1180,10 @@ func (_m *Flags) SetInModernStandby(enabled bool) error { func (_m *Flags) SetInsecureControlTLS(disabled bool) error { ret := _m.Called(disabled) + if len(ret) == 0 { + panic("no return value specified for SetInsecureControlTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(disabled) @@ -914,6 +1198,10 @@ func (_m *Flags) SetInsecureControlTLS(disabled bool) error { func (_m *Flags) SetInsecureTLS(insecure bool) error { ret := _m.Called(insecure) + if len(ret) == 0 { + panic("no return value specified for SetInsecureTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(insecure) @@ -928,6 +1216,10 @@ func (_m *Flags) SetInsecureTLS(insecure bool) error { func (_m *Flags) SetInsecureTransportTLS(insecure bool) error { ret := _m.Called(insecure) + if len(ret) == 0 { + panic("no return value specified for SetInsecureTransportTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(insecure) @@ -942,6 +1234,10 @@ func (_m *Flags) SetInsecureTransportTLS(insecure bool) error { func (_m *Flags) SetKolideServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetKolideServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -956,6 +1252,10 @@ func (_m *Flags) SetKolideServerURL(url string) error { func (_m *Flags) SetLauncherWatchdogEnabled(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetLauncherWatchdogEnabled") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -970,6 +1270,10 @@ func (_m *Flags) SetLauncherWatchdogEnabled(enabled bool) error { func (_m *Flags) SetLogIngestServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetLogIngestServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -984,6 +1288,10 @@ func (_m *Flags) SetLogIngestServerURL(url string) error { func (_m *Flags) SetLogShippingLevel(level string) error { ret := _m.Called(level) + if len(ret) == 0 { + panic("no return value specified for SetLogShippingLevel") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(level) @@ -1003,6 +1311,10 @@ func (_m *Flags) SetLogShippingLevelOverride(value string, duration time.Duratio func (_m *Flags) SetLoggingInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetLoggingInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -1017,6 +1329,10 @@ func (_m *Flags) SetLoggingInterval(interval time.Duration) error { func (_m *Flags) SetMirrorServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetMirrorServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1031,6 +1347,10 @@ func (_m *Flags) SetMirrorServerURL(url string) error { func (_m *Flags) SetOsqueryHealthcheckStartupDelay(delay time.Duration) error { ret := _m.Called(delay) + if len(ret) == 0 { + panic("no return value specified for SetOsqueryHealthcheckStartupDelay") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(delay) @@ -1045,6 +1365,10 @@ func (_m *Flags) SetOsqueryHealthcheckStartupDelay(delay time.Duration) error { func (_m *Flags) SetOsqueryVerbose(verbose bool) error { ret := _m.Called(verbose) + if len(ret) == 0 { + panic("no return value specified for SetOsqueryVerbose") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(verbose) @@ -1059,6 +1383,10 @@ func (_m *Flags) SetOsqueryVerbose(verbose bool) error { func (_m *Flags) SetPinnedLauncherVersion(version string) error { ret := _m.Called(version) + if len(ret) == 0 { + panic("no return value specified for SetPinnedLauncherVersion") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(version) @@ -1073,6 +1401,10 @@ func (_m *Flags) SetPinnedLauncherVersion(version string) error { func (_m *Flags) SetPinnedOsquerydVersion(version string) error { ret := _m.Called(version) + if len(ret) == 0 { + panic("no return value specified for SetPinnedOsquerydVersion") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(version) @@ -1087,6 +1419,10 @@ func (_m *Flags) SetPinnedOsquerydVersion(version string) error { func (_m *Flags) SetTraceBatchTimeout(duration time.Duration) error { ret := _m.Called(duration) + if len(ret) == 0 { + panic("no return value specified for SetTraceBatchTimeout") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(duration) @@ -1101,6 +1437,10 @@ func (_m *Flags) SetTraceBatchTimeout(duration time.Duration) error { func (_m *Flags) SetTraceIngestServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetTraceIngestServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1115,6 +1455,10 @@ func (_m *Flags) SetTraceIngestServerURL(url string) error { func (_m *Flags) SetTraceSamplingRate(rate float64) error { ret := _m.Called(rate) + if len(ret) == 0 { + panic("no return value specified for SetTraceSamplingRate") + } + var r0 error if rf, ok := ret.Get(0).(func(float64) error); ok { r0 = rf(rate) @@ -1134,6 +1478,10 @@ func (_m *Flags) SetTraceSamplingRateOverride(value float64, duration time.Durat func (_m *Flags) SetTufServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetTufServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1148,6 +1496,10 @@ func (_m *Flags) SetTufServerURL(url string) error { func (_m *Flags) SetUpdateChannel(channel string) error { ret := _m.Called(channel) + if len(ret) == 0 { + panic("no return value specified for SetUpdateChannel") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(channel) @@ -1162,6 +1514,10 @@ func (_m *Flags) SetUpdateChannel(channel string) error { func (_m *Flags) SetUpdateDirectory(directory string) error { ret := _m.Called(directory) + if len(ret) == 0 { + panic("no return value specified for SetUpdateDirectory") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(directory) @@ -1176,6 +1532,10 @@ func (_m *Flags) SetUpdateDirectory(directory string) error { func (_m *Flags) SetWatchdogDelaySec(sec int) error { ret := _m.Called(sec) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogDelaySec") + } + var r0 error if rf, ok := ret.Get(0).(func(int) error); ok { r0 = rf(sec) @@ -1190,6 +1550,10 @@ func (_m *Flags) SetWatchdogDelaySec(sec int) error { func (_m *Flags) SetWatchdogEnabled(enable bool) error { ret := _m.Called(enable) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogEnabled") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enable) @@ -1204,6 +1568,10 @@ func (_m *Flags) SetWatchdogEnabled(enable bool) error { func (_m *Flags) SetWatchdogMemoryLimitMB(limit int) error { ret := _m.Called(limit) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogMemoryLimitMB") + } + var r0 error if rf, ok := ret.Get(0).(func(int) error); ok { r0 = rf(limit) @@ -1218,6 +1586,10 @@ func (_m *Flags) SetWatchdogMemoryLimitMB(limit int) error { func (_m *Flags) SetWatchdogUtilizationLimitPercent(limit int) error { ret := _m.Called(limit) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogUtilizationLimitPercent") + } + var r0 error if rf, ok := ret.Get(0).(func(int) error); ok { r0 = rf(limit) @@ -1232,6 +1604,10 @@ func (_m *Flags) SetWatchdogUtilizationLimitPercent(limit int) error { func (_m *Flags) TraceBatchTimeout() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TraceBatchTimeout") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -1246,6 +1622,10 @@ func (_m *Flags) TraceBatchTimeout() time.Duration { func (_m *Flags) TraceIngestServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TraceIngestServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1260,6 +1640,10 @@ func (_m *Flags) TraceIngestServerURL() string { func (_m *Flags) TraceSamplingRate() float64 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TraceSamplingRate") + } + var r0 float64 if rf, ok := ret.Get(0).(func() float64); ok { r0 = rf() @@ -1274,6 +1658,10 @@ func (_m *Flags) TraceSamplingRate() float64 { func (_m *Flags) Transport() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Transport") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1288,6 +1676,10 @@ func (_m *Flags) Transport() string { func (_m *Flags) TufServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TufServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1302,6 +1694,10 @@ func (_m *Flags) TufServerURL() string { func (_m *Flags) UpdateChannel() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for UpdateChannel") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1316,6 +1712,10 @@ func (_m *Flags) UpdateChannel() string { func (_m *Flags) UpdateDirectory() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for UpdateDirectory") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1330,6 +1730,10 @@ func (_m *Flags) UpdateDirectory() string { func (_m *Flags) WatchdogDelaySec() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogDelaySec") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -1344,6 +1748,10 @@ func (_m *Flags) WatchdogDelaySec() int { func (_m *Flags) WatchdogEnabled() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -1358,6 +1766,10 @@ func (_m *Flags) WatchdogEnabled() bool { func (_m *Flags) WatchdogMemoryLimitMB() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogMemoryLimitMB") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -1372,6 +1784,10 @@ func (_m *Flags) WatchdogMemoryLimitMB() int { func (_m *Flags) WatchdogUtilizationLimitPercent() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogUtilizationLimitPercent") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() diff --git a/ee/agent/types/mocks/knapsack.go b/ee/agent/types/mocks/knapsack.go index 5fddb59a9..86ab4397a 100644 --- a/ee/agent/types/mocks/knapsack.go +++ b/ee/agent/types/mocks/knapsack.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.21.1. DO NOT EDIT. +// Code generated by mockery v2.44.1. DO NOT EDIT. package mocks @@ -40,6 +40,10 @@ func (_m *Knapsack) AddSlogHandler(handler ...slog.Handler) { func (_m *Knapsack) AgentFlagsStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AgentFlagsStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -56,6 +60,10 @@ func (_m *Knapsack) AgentFlagsStore() types.GetterSetterDeleterIteratorUpdaterCo func (_m *Knapsack) Autoupdate() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Autoupdate") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -70,6 +78,10 @@ func (_m *Knapsack) Autoupdate() bool { func (_m *Knapsack) AutoupdateErrorsStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AutoupdateErrorsStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -86,6 +98,10 @@ func (_m *Knapsack) AutoupdateErrorsStore() types.GetterSetterDeleterIteratorUpd func (_m *Knapsack) AutoupdateInitialDelay() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AutoupdateInitialDelay") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -100,6 +116,10 @@ func (_m *Knapsack) AutoupdateInitialDelay() time.Duration { func (_m *Knapsack) AutoupdateInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for AutoupdateInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -114,6 +134,10 @@ func (_m *Knapsack) AutoupdateInterval() time.Duration { func (_m *Knapsack) BboltDB() *bbolt.DB { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for BboltDB") + } + var r0 *bbolt.DB if rf, ok := ret.Get(0).(func() *bbolt.DB); ok { r0 = rf() @@ -130,6 +154,10 @@ func (_m *Knapsack) BboltDB() *bbolt.DB { func (_m *Knapsack) CertPins() [][]byte { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CertPins") + } + var r0 [][]byte if rf, ok := ret.Get(0).(func() [][]byte); ok { r0 = rf() @@ -146,6 +174,10 @@ func (_m *Knapsack) CertPins() [][]byte { func (_m *Knapsack) ConfigStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ConfigStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -162,6 +194,10 @@ func (_m *Knapsack) ConfigStore() types.GetterSetterDeleterIteratorUpdaterCounte func (_m *Knapsack) ControlRequestInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ControlRequestInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -176,6 +212,10 @@ func (_m *Knapsack) ControlRequestInterval() time.Duration { func (_m *Knapsack) ControlServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ControlServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -190,6 +230,10 @@ func (_m *Knapsack) ControlServerURL() string { func (_m *Knapsack) ControlStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ControlStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -206,6 +250,10 @@ func (_m *Knapsack) ControlStore() types.GetterSetterDeleterIteratorUpdaterCount func (_m *Knapsack) CurrentEnrollmentStatus() (types.EnrollmentStatus, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for CurrentEnrollmentStatus") + } + var r0 types.EnrollmentStatus var r1 error if rf, ok := ret.Get(0).(func() (types.EnrollmentStatus, error)); ok { @@ -230,6 +278,10 @@ func (_m *Knapsack) CurrentEnrollmentStatus() (types.EnrollmentStatus, error) { func (_m *Knapsack) Debug() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Debug") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -244,6 +296,10 @@ func (_m *Knapsack) Debug() bool { func (_m *Knapsack) DebugLogFile() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DebugLogFile") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -258,6 +314,10 @@ func (_m *Knapsack) DebugLogFile() string { func (_m *Knapsack) DebugServerData() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DebugServerData") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -272,6 +332,10 @@ func (_m *Knapsack) DebugServerData() bool { func (_m *Knapsack) DesktopEnabled() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DesktopEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -286,6 +350,10 @@ func (_m *Knapsack) DesktopEnabled() bool { func (_m *Knapsack) DesktopMenuRefreshInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DesktopMenuRefreshInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -296,10 +364,32 @@ func (_m *Knapsack) DesktopMenuRefreshInterval() time.Duration { return r0 } +// DesktopRunnerServerURL provides a mock function with given fields: +func (_m *Knapsack) DesktopRunnerServerURL() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for DesktopRunnerServerURL") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + // DesktopUpdateInterval provides a mock function with given fields: func (_m *Knapsack) DesktopUpdateInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DesktopUpdateInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -314,6 +404,10 @@ func (_m *Knapsack) DesktopUpdateInterval() time.Duration { func (_m *Knapsack) DisableControlTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DisableControlTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -328,6 +422,10 @@ func (_m *Knapsack) DisableControlTLS() bool { func (_m *Knapsack) DisableTraceIngestTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for DisableTraceIngestTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -342,6 +440,10 @@ func (_m *Knapsack) DisableTraceIngestTLS() bool { func (_m *Knapsack) EnableInitialRunner() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for EnableInitialRunner") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -356,6 +458,10 @@ func (_m *Knapsack) EnableInitialRunner() bool { func (_m *Knapsack) EnrollSecret() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for EnrollSecret") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -370,6 +476,10 @@ func (_m *Knapsack) EnrollSecret() string { func (_m *Knapsack) EnrollSecretPath() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for EnrollSecretPath") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -384,6 +494,10 @@ func (_m *Knapsack) EnrollSecretPath() string { func (_m *Knapsack) ExportTraces() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ExportTraces") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -398,6 +512,10 @@ func (_m *Knapsack) ExportTraces() bool { func (_m *Knapsack) ForceControlSubsystems() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ForceControlSubsystems") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -412,6 +530,10 @@ func (_m *Knapsack) ForceControlSubsystems() bool { func (_m *Knapsack) IAmBreakingEELicense() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IAmBreakingEELicense") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -426,6 +548,10 @@ func (_m *Knapsack) IAmBreakingEELicense() bool { func (_m *Knapsack) InModernStandby() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InModernStandby") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -440,6 +566,10 @@ func (_m *Knapsack) InModernStandby() bool { func (_m *Knapsack) InitialResultsStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InitialResultsStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -456,6 +586,10 @@ func (_m *Knapsack) InitialResultsStore() types.GetterSetterDeleterIteratorUpdat func (_m *Knapsack) InsecureControlTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InsecureControlTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -470,6 +604,10 @@ func (_m *Knapsack) InsecureControlTLS() bool { func (_m *Knapsack) InsecureTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InsecureTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -484,6 +622,10 @@ func (_m *Knapsack) InsecureTLS() bool { func (_m *Knapsack) InsecureTransportTLS() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for InsecureTransportTLS") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -498,6 +640,10 @@ func (_m *Knapsack) InsecureTransportTLS() bool { func (_m *Knapsack) KatcConfigStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for KatcConfigStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -514,6 +660,10 @@ func (_m *Knapsack) KatcConfigStore() types.GetterSetterDeleterIteratorUpdaterCo func (_m *Knapsack) KolideHosted() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for KolideHosted") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -528,6 +678,10 @@ func (_m *Knapsack) KolideHosted() bool { func (_m *Knapsack) KolideServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for KolideServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -542,6 +696,10 @@ func (_m *Knapsack) KolideServerURL() string { func (_m *Knapsack) LatestOsquerydPath(ctx context.Context) string { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for LatestOsquerydPath") + } + var r0 string if rf, ok := ret.Get(0).(func(context.Context) string); ok { r0 = rf(ctx) @@ -556,6 +714,10 @@ func (_m *Knapsack) LatestOsquerydPath(ctx context.Context) string { func (_m *Knapsack) LauncherWatchdogEnabled() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LauncherWatchdogEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -570,6 +732,10 @@ func (_m *Knapsack) LauncherWatchdogEnabled() bool { func (_m *Knapsack) LocalDevelopmentPath() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LocalDevelopmentPath") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -584,6 +750,10 @@ func (_m *Knapsack) LocalDevelopmentPath() string { func (_m *Knapsack) LogIngestServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LogIngestServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -598,6 +768,10 @@ func (_m *Knapsack) LogIngestServerURL() string { func (_m *Knapsack) LogMaxBytesPerBatch() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LogMaxBytesPerBatch") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -612,6 +786,10 @@ func (_m *Knapsack) LogMaxBytesPerBatch() int { func (_m *Knapsack) LogShippingLevel() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LogShippingLevel") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -626,6 +804,10 @@ func (_m *Knapsack) LogShippingLevel() string { func (_m *Knapsack) LoggingInterval() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LoggingInterval") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -640,6 +822,10 @@ func (_m *Knapsack) LoggingInterval() time.Duration { func (_m *Knapsack) MirrorServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for MirrorServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -654,6 +840,10 @@ func (_m *Knapsack) MirrorServerURL() string { func (_m *Knapsack) OsqueryFlags() []string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryFlags") + } + var r0 []string if rf, ok := ret.Get(0).(func() []string); ok { r0 = rf() @@ -670,6 +860,10 @@ func (_m *Knapsack) OsqueryFlags() []string { func (_m *Knapsack) OsqueryHealthcheckStartupDelay() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryHealthcheckStartupDelay") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -684,6 +878,10 @@ func (_m *Knapsack) OsqueryHealthcheckStartupDelay() time.Duration { func (_m *Knapsack) OsqueryHistoryInstanceStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryHistoryInstanceStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -700,6 +898,10 @@ func (_m *Knapsack) OsqueryHistoryInstanceStore() types.GetterSetterDeleterItera func (_m *Knapsack) OsqueryTlsConfigEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsConfigEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -714,6 +916,10 @@ func (_m *Knapsack) OsqueryTlsConfigEndpoint() string { func (_m *Knapsack) OsqueryTlsDistributedReadEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsDistributedReadEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -728,6 +934,10 @@ func (_m *Knapsack) OsqueryTlsDistributedReadEndpoint() string { func (_m *Knapsack) OsqueryTlsDistributedWriteEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsDistributedWriteEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -742,6 +952,10 @@ func (_m *Knapsack) OsqueryTlsDistributedWriteEndpoint() string { func (_m *Knapsack) OsqueryTlsEnrollEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsEnrollEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -756,6 +970,10 @@ func (_m *Knapsack) OsqueryTlsEnrollEndpoint() string { func (_m *Knapsack) OsqueryTlsLoggerEndpoint() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryTlsLoggerEndpoint") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -770,6 +988,10 @@ func (_m *Knapsack) OsqueryTlsLoggerEndpoint() string { func (_m *Knapsack) OsqueryVerbose() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsqueryVerbose") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -784,6 +1006,10 @@ func (_m *Knapsack) OsqueryVerbose() bool { func (_m *Knapsack) OsquerydPath() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OsquerydPath") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -798,6 +1024,10 @@ func (_m *Knapsack) OsquerydPath() string { func (_m *Knapsack) PersistentHostDataStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PersistentHostDataStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -814,6 +1044,10 @@ func (_m *Knapsack) PersistentHostDataStore() types.GetterSetterDeleterIteratorU func (_m *Knapsack) PinnedLauncherVersion() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PinnedLauncherVersion") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -828,6 +1062,10 @@ func (_m *Knapsack) PinnedLauncherVersion() string { func (_m *Knapsack) PinnedOsquerydVersion() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for PinnedOsquerydVersion") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -842,6 +1080,10 @@ func (_m *Knapsack) PinnedOsquerydVersion() string { func (_m *Knapsack) ReadEnrollSecret() (string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ReadEnrollSecret") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func() (string, error)); ok { @@ -878,6 +1120,10 @@ func (_m *Knapsack) RegisterChangeObserver(observer types.FlagsChangeObserver, f func (_m *Knapsack) ResultLogsStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ResultLogsStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -894,6 +1140,10 @@ func (_m *Knapsack) ResultLogsStore() types.GetterSetterDeleterIteratorUpdaterCo func (_m *Knapsack) RootDirectory() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for RootDirectory") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -908,6 +1158,10 @@ func (_m *Knapsack) RootDirectory() string { func (_m *Knapsack) RootPEM() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for RootPEM") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -922,6 +1176,10 @@ func (_m *Knapsack) RootPEM() string { func (_m *Knapsack) SentNotificationsStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for SentNotificationsStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -938,6 +1196,10 @@ func (_m *Knapsack) SentNotificationsStore() types.GetterSetterDeleterIteratorUp func (_m *Knapsack) ServerProvidedDataStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ServerProvidedDataStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -954,6 +1216,10 @@ func (_m *Knapsack) ServerProvidedDataStore() types.GetterSetterDeleterIteratorU func (_m *Knapsack) SetAutoupdate(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetAutoupdate") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -968,6 +1234,10 @@ func (_m *Knapsack) SetAutoupdate(enabled bool) error { func (_m *Knapsack) SetAutoupdateInitialDelay(delay time.Duration) error { ret := _m.Called(delay) + if len(ret) == 0 { + panic("no return value specified for SetAutoupdateInitialDelay") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(delay) @@ -982,6 +1252,10 @@ func (_m *Knapsack) SetAutoupdateInitialDelay(delay time.Duration) error { func (_m *Knapsack) SetAutoupdateInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetAutoupdateInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -996,6 +1270,10 @@ func (_m *Knapsack) SetAutoupdateInterval(interval time.Duration) error { func (_m *Knapsack) SetControlRequestInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetControlRequestInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -1015,6 +1293,10 @@ func (_m *Knapsack) SetControlRequestIntervalOverride(value time.Duration, durat func (_m *Knapsack) SetControlServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetControlServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1029,6 +1311,10 @@ func (_m *Knapsack) SetControlServerURL(url string) error { func (_m *Knapsack) SetDebug(debug bool) error { ret := _m.Called(debug) + if len(ret) == 0 { + panic("no return value specified for SetDebug") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(debug) @@ -1043,6 +1329,10 @@ func (_m *Knapsack) SetDebug(debug bool) error { func (_m *Knapsack) SetDebugServerData(debug bool) error { ret := _m.Called(debug) + if len(ret) == 0 { + panic("no return value specified for SetDebugServerData") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(debug) @@ -1057,6 +1347,10 @@ func (_m *Knapsack) SetDebugServerData(debug bool) error { func (_m *Knapsack) SetDesktopEnabled(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetDesktopEnabled") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -1071,6 +1365,10 @@ func (_m *Knapsack) SetDesktopEnabled(enabled bool) error { func (_m *Knapsack) SetDesktopMenuRefreshInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetDesktopMenuRefreshInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -1081,10 +1379,32 @@ func (_m *Knapsack) SetDesktopMenuRefreshInterval(interval time.Duration) error return r0 } +// SetDesktopRunnerServerURL provides a mock function with given fields: url +func (_m *Knapsack) SetDesktopRunnerServerURL(url string) error { + ret := _m.Called(url) + + if len(ret) == 0 { + panic("no return value specified for SetDesktopRunnerServerURL") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(url) + } else { + r0 = ret.Error(0) + } + + return r0 +} + // SetDesktopUpdateInterval provides a mock function with given fields: interval func (_m *Knapsack) SetDesktopUpdateInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetDesktopUpdateInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -1099,6 +1419,10 @@ func (_m *Knapsack) SetDesktopUpdateInterval(interval time.Duration) error { func (_m *Knapsack) SetDisableControlTLS(disabled bool) error { ret := _m.Called(disabled) + if len(ret) == 0 { + panic("no return value specified for SetDisableControlTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(disabled) @@ -1113,6 +1437,10 @@ func (_m *Knapsack) SetDisableControlTLS(disabled bool) error { func (_m *Knapsack) SetDisableTraceIngestTLS(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetDisableTraceIngestTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -1127,6 +1455,10 @@ func (_m *Knapsack) SetDisableTraceIngestTLS(enabled bool) error { func (_m *Knapsack) SetExportTraces(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetExportTraces") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -1146,6 +1478,10 @@ func (_m *Knapsack) SetExportTracesOverride(value bool, duration time.Duration) func (_m *Knapsack) SetForceControlSubsystems(force bool) error { ret := _m.Called(force) + if len(ret) == 0 { + panic("no return value specified for SetForceControlSubsystems") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(force) @@ -1160,6 +1496,10 @@ func (_m *Knapsack) SetForceControlSubsystems(force bool) error { func (_m *Knapsack) SetInModernStandby(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetInModernStandby") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -1174,6 +1514,10 @@ func (_m *Knapsack) SetInModernStandby(enabled bool) error { func (_m *Knapsack) SetInsecureControlTLS(disabled bool) error { ret := _m.Called(disabled) + if len(ret) == 0 { + panic("no return value specified for SetInsecureControlTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(disabled) @@ -1188,6 +1532,10 @@ func (_m *Knapsack) SetInsecureControlTLS(disabled bool) error { func (_m *Knapsack) SetInsecureTLS(insecure bool) error { ret := _m.Called(insecure) + if len(ret) == 0 { + panic("no return value specified for SetInsecureTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(insecure) @@ -1202,6 +1550,10 @@ func (_m *Knapsack) SetInsecureTLS(insecure bool) error { func (_m *Knapsack) SetInsecureTransportTLS(insecure bool) error { ret := _m.Called(insecure) + if len(ret) == 0 { + panic("no return value specified for SetInsecureTransportTLS") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(insecure) @@ -1216,6 +1568,10 @@ func (_m *Knapsack) SetInsecureTransportTLS(insecure bool) error { func (_m *Knapsack) SetKolideServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetKolideServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1230,6 +1586,10 @@ func (_m *Knapsack) SetKolideServerURL(url string) error { func (_m *Knapsack) SetLauncherWatchdogEnabled(enabled bool) error { ret := _m.Called(enabled) + if len(ret) == 0 { + panic("no return value specified for SetLauncherWatchdogEnabled") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enabled) @@ -1244,6 +1604,10 @@ func (_m *Knapsack) SetLauncherWatchdogEnabled(enabled bool) error { func (_m *Knapsack) SetLogIngestServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetLogIngestServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1258,6 +1622,10 @@ func (_m *Knapsack) SetLogIngestServerURL(url string) error { func (_m *Knapsack) SetLogShippingLevel(level string) error { ret := _m.Called(level) + if len(ret) == 0 { + panic("no return value specified for SetLogShippingLevel") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(level) @@ -1277,6 +1645,10 @@ func (_m *Knapsack) SetLogShippingLevelOverride(value string, duration time.Dura func (_m *Knapsack) SetLoggingInterval(interval time.Duration) error { ret := _m.Called(interval) + if len(ret) == 0 { + panic("no return value specified for SetLoggingInterval") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(interval) @@ -1291,6 +1663,10 @@ func (_m *Knapsack) SetLoggingInterval(interval time.Duration) error { func (_m *Knapsack) SetMirrorServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetMirrorServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1305,6 +1681,10 @@ func (_m *Knapsack) SetMirrorServerURL(url string) error { func (_m *Knapsack) SetOsqueryHealthcheckStartupDelay(delay time.Duration) error { ret := _m.Called(delay) + if len(ret) == 0 { + panic("no return value specified for SetOsqueryHealthcheckStartupDelay") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(delay) @@ -1319,6 +1699,10 @@ func (_m *Knapsack) SetOsqueryHealthcheckStartupDelay(delay time.Duration) error func (_m *Knapsack) SetOsqueryVerbose(verbose bool) error { ret := _m.Called(verbose) + if len(ret) == 0 { + panic("no return value specified for SetOsqueryVerbose") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(verbose) @@ -1333,6 +1717,10 @@ func (_m *Knapsack) SetOsqueryVerbose(verbose bool) error { func (_m *Knapsack) SetPinnedLauncherVersion(version string) error { ret := _m.Called(version) + if len(ret) == 0 { + panic("no return value specified for SetPinnedLauncherVersion") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(version) @@ -1347,6 +1735,10 @@ func (_m *Knapsack) SetPinnedLauncherVersion(version string) error { func (_m *Knapsack) SetPinnedOsquerydVersion(version string) error { ret := _m.Called(version) + if len(ret) == 0 { + panic("no return value specified for SetPinnedOsquerydVersion") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(version) @@ -1361,6 +1753,10 @@ func (_m *Knapsack) SetPinnedOsquerydVersion(version string) error { func (_m *Knapsack) SetTraceBatchTimeout(duration time.Duration) error { ret := _m.Called(duration) + if len(ret) == 0 { + panic("no return value specified for SetTraceBatchTimeout") + } + var r0 error if rf, ok := ret.Get(0).(func(time.Duration) error); ok { r0 = rf(duration) @@ -1375,6 +1771,10 @@ func (_m *Knapsack) SetTraceBatchTimeout(duration time.Duration) error { func (_m *Knapsack) SetTraceIngestServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetTraceIngestServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1389,6 +1789,10 @@ func (_m *Knapsack) SetTraceIngestServerURL(url string) error { func (_m *Knapsack) SetTraceSamplingRate(rate float64) error { ret := _m.Called(rate) + if len(ret) == 0 { + panic("no return value specified for SetTraceSamplingRate") + } + var r0 error if rf, ok := ret.Get(0).(func(float64) error); ok { r0 = rf(rate) @@ -1408,6 +1812,10 @@ func (_m *Knapsack) SetTraceSamplingRateOverride(value float64, duration time.Du func (_m *Knapsack) SetTufServerURL(url string) error { ret := _m.Called(url) + if len(ret) == 0 { + panic("no return value specified for SetTufServerURL") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(url) @@ -1422,6 +1830,10 @@ func (_m *Knapsack) SetTufServerURL(url string) error { func (_m *Knapsack) SetUpdateChannel(channel string) error { ret := _m.Called(channel) + if len(ret) == 0 { + panic("no return value specified for SetUpdateChannel") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(channel) @@ -1436,6 +1848,10 @@ func (_m *Knapsack) SetUpdateChannel(channel string) error { func (_m *Knapsack) SetUpdateDirectory(directory string) error { ret := _m.Called(directory) + if len(ret) == 0 { + panic("no return value specified for SetUpdateDirectory") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(directory) @@ -1450,6 +1866,10 @@ func (_m *Knapsack) SetUpdateDirectory(directory string) error { func (_m *Knapsack) SetWatchdogDelaySec(sec int) error { ret := _m.Called(sec) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogDelaySec") + } + var r0 error if rf, ok := ret.Get(0).(func(int) error); ok { r0 = rf(sec) @@ -1464,6 +1884,10 @@ func (_m *Knapsack) SetWatchdogDelaySec(sec int) error { func (_m *Knapsack) SetWatchdogEnabled(enable bool) error { ret := _m.Called(enable) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogEnabled") + } + var r0 error if rf, ok := ret.Get(0).(func(bool) error); ok { r0 = rf(enable) @@ -1478,6 +1902,10 @@ func (_m *Knapsack) SetWatchdogEnabled(enable bool) error { func (_m *Knapsack) SetWatchdogMemoryLimitMB(limit int) error { ret := _m.Called(limit) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogMemoryLimitMB") + } + var r0 error if rf, ok := ret.Get(0).(func(int) error); ok { r0 = rf(limit) @@ -1492,6 +1920,10 @@ func (_m *Knapsack) SetWatchdogMemoryLimitMB(limit int) error { func (_m *Knapsack) SetWatchdogUtilizationLimitPercent(limit int) error { ret := _m.Called(limit) + if len(ret) == 0 { + panic("no return value specified for SetWatchdogUtilizationLimitPercent") + } + var r0 error if rf, ok := ret.Get(0).(func(int) error); ok { r0 = rf(limit) @@ -1506,6 +1938,10 @@ func (_m *Knapsack) SetWatchdogUtilizationLimitPercent(limit int) error { func (_m *Knapsack) Slogger() *slog.Logger { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Slogger") + } + var r0 *slog.Logger if rf, ok := ret.Get(0).(func() *slog.Logger); ok { r0 = rf() @@ -1522,6 +1958,10 @@ func (_m *Knapsack) Slogger() *slog.Logger { func (_m *Knapsack) StatusLogsStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for StatusLogsStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -1538,6 +1978,10 @@ func (_m *Knapsack) StatusLogsStore() types.GetterSetterDeleterIteratorUpdaterCo func (_m *Knapsack) Stores() map[storage.Store]types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Stores") + } + var r0 map[storage.Store]types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() map[storage.Store]types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -1554,6 +1998,10 @@ func (_m *Knapsack) Stores() map[storage.Store]types.GetterSetterDeleterIterator func (_m *Knapsack) SystemSlogger() *slog.Logger { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for SystemSlogger") + } + var r0 *slog.Logger if rf, ok := ret.Get(0).(func() *slog.Logger); ok { r0 = rf() @@ -1570,6 +2018,10 @@ func (_m *Knapsack) SystemSlogger() *slog.Logger { func (_m *Knapsack) TokenStore() types.GetterSetterDeleterIteratorUpdaterCounterAppender { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TokenStore") + } + var r0 types.GetterSetterDeleterIteratorUpdaterCounterAppender if rf, ok := ret.Get(0).(func() types.GetterSetterDeleterIteratorUpdaterCounterAppender); ok { r0 = rf() @@ -1586,6 +2038,10 @@ func (_m *Knapsack) TokenStore() types.GetterSetterDeleterIteratorUpdaterCounter func (_m *Knapsack) TraceBatchTimeout() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TraceBatchTimeout") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -1600,6 +2056,10 @@ func (_m *Knapsack) TraceBatchTimeout() time.Duration { func (_m *Knapsack) TraceIngestServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TraceIngestServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1614,6 +2074,10 @@ func (_m *Knapsack) TraceIngestServerURL() string { func (_m *Knapsack) TraceSamplingRate() float64 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TraceSamplingRate") + } + var r0 float64 if rf, ok := ret.Get(0).(func() float64); ok { r0 = rf() @@ -1628,6 +2092,10 @@ func (_m *Knapsack) TraceSamplingRate() float64 { func (_m *Knapsack) Transport() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Transport") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1642,6 +2110,10 @@ func (_m *Knapsack) Transport() string { func (_m *Knapsack) TufServerURL() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TufServerURL") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1656,6 +2128,10 @@ func (_m *Knapsack) TufServerURL() string { func (_m *Knapsack) UpdateChannel() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for UpdateChannel") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1670,6 +2146,10 @@ func (_m *Knapsack) UpdateChannel() string { func (_m *Knapsack) UpdateDirectory() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for UpdateDirectory") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -1684,6 +2164,10 @@ func (_m *Knapsack) UpdateDirectory() string { func (_m *Knapsack) WatchdogDelaySec() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogDelaySec") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -1698,6 +2182,10 @@ func (_m *Knapsack) WatchdogDelaySec() int { func (_m *Knapsack) WatchdogEnabled() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogEnabled") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -1712,6 +2200,10 @@ func (_m *Knapsack) WatchdogEnabled() bool { func (_m *Knapsack) WatchdogMemoryLimitMB() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogMemoryLimitMB") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -1726,6 +2218,10 @@ func (_m *Knapsack) WatchdogMemoryLimitMB() int { func (_m *Knapsack) WatchdogUtilizationLimitPercent() int { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for WatchdogUtilizationLimitPercent") + } + var r0 int if rf, ok := ret.Get(0).(func() int); ok { r0 = rf() @@ -1736,13 +2232,12 @@ func (_m *Knapsack) WatchdogUtilizationLimitPercent() int { return r0 } -type mockConstructorTestingTNewKnapsack interface { +// NewKnapsack creates a new instance of Knapsack. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewKnapsack(t interface { mock.TestingT Cleanup(func()) -} - -// NewKnapsack creates a new instance of Knapsack. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewKnapsack(t mockConstructorTestingTNewKnapsack) *Knapsack { +}) *Knapsack { mock := &Knapsack{} mock.Mock.Test(t) diff --git a/ee/desktop/runner/runner.go b/ee/desktop/runner/runner.go index 6db30198b..92e531453 100644 --- a/ee/desktop/runner/runner.go +++ b/ee/desktop/runner/runner.go @@ -23,6 +23,7 @@ import ( "github.com/kolide/kit/version" "github.com/kolide/launcher/ee/agent" "github.com/kolide/launcher/ee/agent/flags/keys" + "github.com/kolide/launcher/ee/agent/startupsettings" "github.com/kolide/launcher/ee/agent/types" "github.com/kolide/launcher/ee/consoleuser" runnerserver "github.com/kolide/launcher/ee/desktop/runner/server" @@ -196,6 +197,24 @@ func New(k types.Knapsack, messenger runnerserver.Messenger, opts ...desktopUser } }() + runner.knapsack.SetDesktopRunnerServerURL(runner.runnerServer.Url()) + + settingsWriter, err := startupsettings.OpenWriter(context.TODO(), runner.knapsack) + if err != nil { + runner.slogger.Log(context.TODO(), slog.LevelError, + "opening startup settings writer to write desktop runner server url", + "err", err, + ) + } else { + defer settingsWriter.Close() + if err := settingsWriter.WriteSettings(); err != nil { + runner.slogger.Log(context.TODO(), slog.LevelError, + "writing startup settings to write desktop runner server url", + "err", err, + ) + } + } + if runtime.GOOS == "darwin" { runner.osVersion, err = osversion() if err != nil { diff --git a/ee/desktop/runner/server/server.go b/ee/desktop/runner/server/server.go index 2e77cbcf7..625b03f66 100644 --- a/ee/desktop/runner/server/server.go +++ b/ee/desktop/runner/server/server.go @@ -31,6 +31,7 @@ const ( HealthCheckEndpoint = "/health" MenuOpenedEndpoint = "/menuopened" MessageEndpoint = "/message" + RecheckEndpoint = "/recheck" controlRequestAccelerationInterval = 5 * time.Second controlRequestAcclerationDuration = 1 * time.Minute ) @@ -65,17 +66,18 @@ func New(slogger *slog.Logger, rs.slogger = slogger.With("component", "desktop_runner_root_server") - mux := http.NewServeMux() + authedMux := http.NewServeMux() + unauthedMux := http.NewServeMux() // health check endpoint - mux.HandleFunc(HealthCheckEndpoint, func(w http.ResponseWriter, r *http.Request) { + authedMux.HandleFunc(HealthCheckEndpoint, func(w http.ResponseWriter, r *http.Request) { if r.Body != nil { r.Body.Close() } }) // menu opened endpoint - mux.HandleFunc(MenuOpenedEndpoint, func(w http.ResponseWriter, r *http.Request) { + authedMux.HandleFunc(MenuOpenedEndpoint, func(w http.ResponseWriter, r *http.Request) { if r.Body != nil { r.Body.Close() } @@ -83,10 +85,39 @@ func New(slogger *slog.Logger, controlRequestIntervalOverrider.SetControlRequestIntervalOverride(controlRequestAccelerationInterval, controlRequestAcclerationDuration) }) - mux.Handle(MessageEndpoint, http.HandlerFunc(rs.sendMessage)) + authedMux.Handle(MessageEndpoint, http.HandlerFunc(rs.sendMessage)) + authMuxHandler := rs.authMiddleware(authedMux) + + unauthedMux.Handle(RecheckEndpoint, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.Body != nil { + r.Body.Close() + } + + if err := messenger.SendMessage("recheck", nil); err != nil { + rs.slogger.Log(r.Context(), slog.LevelError, + "error sending recheck message", + "err", err, + ) + + w.WriteHeader(http.StatusInternalServerError) + return + } + + w.WriteHeader(http.StatusOK) + })) + + mainMux := http.NewServeMux() + + // authed endpoints + mainMux.Handle(HealthCheckEndpoint, authMuxHandler) + mainMux.Handle(MenuOpenedEndpoint, authMuxHandler) + mainMux.Handle(MessageEndpoint, authMuxHandler) + + // unauthed endpoints + mainMux.Handle(RecheckEndpoint, unauthedMux) rs.server = &http.Server{ - Handler: rs.authMiddleware(mux), + Handler: mainMux, } return rs, err diff --git a/ee/desktop/runner/server/server_test.go b/ee/desktop/runner/server/server_test.go index 2cb383e44..4442f6161 100644 --- a/ee/desktop/runner/server/server_test.go +++ b/ee/desktop/runner/server/server_test.go @@ -88,6 +88,13 @@ func TestRootServer(t *testing.T) { require.NoError(t, err) require.Equal(t, http.StatusUnauthorized, response.StatusCode) + // recheck endpoint should always work since it's unauthenticated + messenger.On("SendMessage", "recheck", mock.Anything).Return(nil).Once() + response, err = client.Get(endpointUrl(monitorServer.Url(), RecheckEndpoint)) + require.NoError(t, response.Body.Close()) + require.NoError(t, err) + require.Equal(t, http.StatusOK, response.StatusCode) + require.NoError(t, monitorServer.Shutdown(context.Background())) } From 42817edb8cb4b4ad2f9c106a3da881ad08c950cb Mon Sep 17 00:00:00 2001 From: James Pickett Date: Thu, 15 Aug 2024 12:25:16 -0700 Subject: [PATCH 2/3] fix desktop runner tests --- ee/desktop/runner/runner_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/ee/desktop/runner/runner_test.go b/ee/desktop/runner/runner_test.go index 7d73da982..5ef043f68 100644 --- a/ee/desktop/runner/runner_test.go +++ b/ee/desktop/runner/runner_test.go @@ -16,6 +16,7 @@ import ( "github.com/kolide/kit/ulid" "github.com/kolide/launcher/ee/agent/flags/keys" + "github.com/kolide/launcher/ee/agent/storage/inmemory" "github.com/kolide/launcher/ee/agent/types/mocks" "github.com/kolide/launcher/ee/desktop/user/notify" "github.com/kolide/launcher/pkg/log/multislogger" @@ -120,12 +121,22 @@ func TestDesktopUserProcessRunner_Execute(t *testing.T) { mockKnapsack := mocks.NewKnapsack(t) mockKnapsack.On("RegisterChangeObserver", mock.Anything, keys.DesktopEnabled) + mockKnapsack.On("DesktopUpdateInterval").Return(time.Millisecond * 250) mockKnapsack.On("DesktopMenuRefreshInterval").Return(time.Millisecond * 250) mockKnapsack.On("KolideServerURL").Return("somewhere-over-the-rainbow.example.com") mockKnapsack.On("DesktopEnabled").Return(true) mockKnapsack.On("Slogger").Return(slogger) mockKnapsack.On("InModernStandby").Return(false) + mockKnapsack.On("SetDesktopRunnerServerURL", mock.Anything).Return(nil) + mockKnapsack.On("RootDirectory").Return(t.TempDir()) + mockKnapsack.On("RegisterChangeObserver", mock.Anything, mock.Anything) + mockKnapsack.On("PinnedLauncherVersion").Return("0.0.0") + mockKnapsack.On("PinnedOsquerydVersion").Return("0.0.0") + mockKnapsack.On("UpdateChannel").Return("stable") + mockKnapsack.On("DesktopRunnerServerURL").Return(ulid.New()) + mockKnapsack.On("ConfigStore").Return(inmemory.NewStore()) + mockKnapsack.On("KatcConfigStore").Return(inmemory.NewStore()) if os.Getenv("CI") != "true" || runtime.GOOS != "linux" { // Only expect that we call Debug (to set the DEBUG flag on the process) if we actually expect @@ -300,6 +311,15 @@ func TestUpdate(t *testing.T) { mockKnapsack.On("DesktopEnabled").Return(true) mockKnapsack.On("Slogger").Return(multislogger.NewNopLogger()) mockKnapsack.On("InModernStandby").Return(false) + mockKnapsack.On("SetDesktopRunnerServerURL", mock.Anything).Return(nil) + mockKnapsack.On("RootDirectory").Return(t.TempDir()) + mockKnapsack.On("RegisterChangeObserver", mock.Anything, mock.Anything) + mockKnapsack.On("PinnedLauncherVersion").Return("0.0.0") + mockKnapsack.On("PinnedOsquerydVersion").Return("0.0.0") + mockKnapsack.On("UpdateChannel").Return("stable") + mockKnapsack.On("DesktopRunnerServerURL").Return(ulid.New()) + mockKnapsack.On("ConfigStore").Return(inmemory.NewStore()) + mockKnapsack.On("KatcConfigStore").Return(inmemory.NewStore()) dir := t.TempDir() r, err := New(mockKnapsack, nil, WithUsersFilesRoot(dir)) @@ -335,6 +355,15 @@ func TestSendNotification_NoProcessesYet(t *testing.T) { mockKnapsack.On("DesktopEnabled").Return(true) mockKnapsack.On("Slogger").Return(multislogger.NewNopLogger()) mockKnapsack.On("InModernStandby").Return(false) + mockKnapsack.On("SetDesktopRunnerServerURL", mock.Anything).Return(nil) + mockKnapsack.On("RootDirectory").Return(t.TempDir()) + mockKnapsack.On("RegisterChangeObserver", mock.Anything, mock.Anything) + mockKnapsack.On("PinnedLauncherVersion").Return("0.0.0") + mockKnapsack.On("PinnedOsquerydVersion").Return("0.0.0") + mockKnapsack.On("UpdateChannel").Return("stable") + mockKnapsack.On("DesktopRunnerServerURL").Return(ulid.New()) + mockKnapsack.On("ConfigStore").Return(inmemory.NewStore()) + mockKnapsack.On("KatcConfigStore").Return(inmemory.NewStore()) dir := t.TempDir() r, err := New(mockKnapsack, nil, WithUsersFilesRoot(dir)) From abc07fbcba781e8f372f49e2e75bf8eb68df458a Mon Sep 17 00:00:00 2001 From: James Pickett Date: Thu, 15 Aug 2024 14:17:52 -0700 Subject: [PATCH 3/3] more test fixes --- ee/agent/startupsettings/writer.go | 9 ++++----- ee/agent/startupsettings/writer_test.go | 9 +++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ee/agent/startupsettings/writer.go b/ee/agent/startupsettings/writer.go index 240e6fc6e..f5fa86a6e 100644 --- a/ee/agent/startupsettings/writer.go +++ b/ee/agent/startupsettings/writer.go @@ -38,9 +38,10 @@ func OpenWriter(ctx context.Context, knapsack types.Knapsack) (*startupSettingsW kvStore: store, knapsack: knapsack, storedFlags: map[keys.FlagKey]func() string{ - keys.UpdateChannel: func() string { return knapsack.UpdateChannel() }, - keys.PinnedLauncherVersion: func() string { return knapsack.PinnedLauncherVersion() }, - keys.PinnedOsquerydVersion: func() string { return knapsack.PinnedOsquerydVersion() }, + keys.UpdateChannel: func() string { return knapsack.UpdateChannel() }, + keys.PinnedLauncherVersion: func() string { return knapsack.PinnedLauncherVersion() }, + keys.PinnedOsquerydVersion: func() string { return knapsack.PinnedOsquerydVersion() }, + keys.DesktopRunnerServerUrl: func() string { return knapsack.DesktopRunnerServerURL() }, }, } @@ -70,8 +71,6 @@ func (s *startupSettingsWriter) WriteSettings() error { } updatedFlags["use_tuf_autoupdater"] = "enabled" // Hardcode for backwards compatibility circa v1.5.3 - updatedFlags[keys.DesktopRunnerServerUrl.String()] = s.knapsack.DesktopRunnerServerURL() - atcConfig, err := s.extractAutoTableConstructionConfig() if err != nil { s.knapsack.Slogger().Log(context.TODO(), slog.LevelDebug, diff --git a/ee/agent/startupsettings/writer_test.go b/ee/agent/startupsettings/writer_test.go index a46e5ae2a..f6c06b5ec 100644 --- a/ee/agent/startupsettings/writer_test.go +++ b/ee/agent/startupsettings/writer_test.go @@ -28,6 +28,7 @@ func TestOpenWriter_NewDatabase(t *testing.T) { k.On("RegisterChangeObserver", mock.Anything, keys.UpdateChannel) k.On("RegisterChangeObserver", mock.Anything, keys.PinnedLauncherVersion) k.On("RegisterChangeObserver", mock.Anything, keys.PinnedOsquerydVersion) + k.On("RegisterChangeObserver", mock.Anything, keys.DesktopRunnerServerUrl) updateChannelVal := "stable" k.On("UpdateChannel").Return(updateChannelVal) k.On("PinnedLauncherVersion").Return("") @@ -36,6 +37,8 @@ func TestOpenWriter_NewDatabase(t *testing.T) { k.On("Slogger").Return(multislogger.NewNopLogger()) k.On("KatcConfigStore").Return(inmemory.NewStore()) + k.On("DesktopRunnerServerURL").Return(ulid.New()) + // Set up storage db, which should create the database and set all flags s, err := OpenWriter(context.TODO(), k) require.NoError(t, err, "expected no error setting up storage db") @@ -87,6 +90,7 @@ func TestOpenWriter_DatabaseAlreadyExists(t *testing.T) { k.On("RegisterChangeObserver", mock.Anything, keys.UpdateChannel) k.On("RegisterChangeObserver", mock.Anything, keys.PinnedLauncherVersion) k.On("RegisterChangeObserver", mock.Anything, keys.PinnedOsquerydVersion) + k.On("RegisterChangeObserver", mock.Anything, keys.DesktopRunnerServerUrl) // Set up flag updateChannelVal := "alpha" @@ -99,6 +103,8 @@ func TestOpenWriter_DatabaseAlreadyExists(t *testing.T) { k.On("ConfigStore").Return(inmemory.NewStore()) k.On("Slogger").Return(multislogger.NewNopLogger()) + k.On("DesktopRunnerServerURL").Return(ulid.New()) + // Set up storage db, which should create the database and set all flags s, err := OpenWriter(context.TODO(), k) require.NoError(t, err, "expected no error setting up storage db") @@ -132,6 +138,7 @@ func TestFlagsChanged(t *testing.T) { k.On("RegisterChangeObserver", mock.Anything, keys.UpdateChannel) k.On("RegisterChangeObserver", mock.Anything, keys.PinnedLauncherVersion) k.On("RegisterChangeObserver", mock.Anything, keys.PinnedOsquerydVersion) + k.On("RegisterChangeObserver", mock.Anything, keys.DesktopRunnerServerUrl) updateChannelVal := "beta" k.On("UpdateChannel").Return(updateChannelVal).Once() pinnedLauncherVersion := "1.2.3" @@ -139,6 +146,8 @@ func TestFlagsChanged(t *testing.T) { pinnedOsquerydVersion := "5.3.2" k.On("PinnedOsquerydVersion").Return(pinnedOsquerydVersion).Once() + k.On("DesktopRunnerServerURL").Return(ulid.New()) + autoTableConstructionValue := ulid.New() configStore := inmemory.NewStore()