@Override
    public Output run(RunContext runContext) throws Exception {
        LogService logService = ((DefaultRunContext)runContext).getApplicationContext().getBean(LogService.class);
        FlowService flowService = ((DefaultRunContext)runContext).getApplicationContext().getBean(FlowService.class);

        // validate that this namespace is authorized on the target namespace / all namespaces
        var flowInfo = runContext.flowInfo();
        if (namespace == null){
            flowService.checkAllowedAllNamespaces(flowInfo.tenantId(), flowInfo.tenantId(), flowInfo.namespace());
        } else if (!runContext.render(namespace).equals(flowInfo.namespace())) {
            flowService.checkAllowedNamespace(flowInfo.tenantId(), runContext.render(namespace), flowInfo.tenantId(), flowInfo.namespace());
        }

        int deleted = logService.purge(
            flowInfo.tenantId(),
            runContext.render(namespace),
            runContext.render(flowId),
            logLevels,
            startDate != null ? ZonedDateTime.parse(runContext.render(startDate)) : null,
            ZonedDateTime.parse(runContext.render(endDate))
        );

        return Output.builder().count(deleted).build();
    }
@Test
    void run() throws Exception {
        // create an execution to delete
        var logEntry = LogEntry.builder()
            .namespace("namespace")
            .flowId("flowId")
            .timestamp(Instant.now())
            .level(Level.INFO)
            .message("Hello World")
            .build();
        logRepository.save(logEntry);

        var purge = PurgeLogs.builder()
            .endDate(ZonedDateTime.now().plusMinutes(1).format(DateTimeFormatter.ISO_ZONED_DATE_TIME))
            .build();
        var runContext = runContextFactory.of(Map.of("flow", Map.of("namespace", "namespace", "id", "flowId")));
        var output = purge.run(runContext);

        assertThat(output.getCount(), is(1));
    }