final WorkAttempt performWork() {
        try {
            LOG.debug("[Agent Loop] Trying to retrieve work.");
            agentUpgradeService.checkForUpgradeAndExtraProperties();
            sslInfrastructureService.registerIfNecessary(getAgentAutoRegistrationProperties());

            if (pluginJarLocationMonitor.hasRunAtLeastOnce()) {
                return tryDoWork();
            } else {
                LOG.debug("[Agent Loop] PluginLocationMonitor has not yet run. Not retrieving work since plugins may not be initialized.");
                return WorkAttempt.FAILED;
            }

        } catch (Exception e) {
            if (isCausedBySecurity(e)) {
                handleSecurityException(e);
            } else {
                LOG.error("[Agent Loop] Error occurred during loop: ", e);
            }
            return WorkAttempt.FAILED;
        }
    }
@Test
    void shouldNotTryWorkIfPluginMonitorHasNotRun() {
        when(pluginJarLocationMonitor.hasRunAtLeastOnce()).thenReturn(false);
        assertThat(agentController.performWork()).isEqualTo(WorkAttempt.FAILED);
        verify(pluginJarLocationMonitor).hasRunAtLeastOnce();
    }