FlyteAdminClient { public ExecutionOuterClass.ExecutionList listExecutions( String project, String domain, int limit, String token, String filters) { LOG.debug("listExecutions {} {} {} {}", project, domain, limit, token); final var request = Common.ResourceListRequest .newBuilder() .setId(Common.NamedEntityIdentifier .newBuilder() .setProject(project) .setDomain(domain) .build()) .setLimit(limit) .setToken(nullToEmpty(token)) .setFilters(nullToEmpty(filters)) .build(); return stub.listExecutions(request); } FlyteAdminClient(AdminServiceGrpc.AdminServiceBlockingStub stub); static FlyteAdminClient create(String target, boolean insecure); ExecutionOuterClass.ExecutionCreateResponse createExecution(
      String project,
      String domain,
      String name,
      IdentifierOuterClass.Identifier launchPlanId,
      ExecutionOuterClass.ExecutionMetadata.ExecutionMode executionMode,
      Map<String, String> annotations,
      String parameter); ExecutionOuterClass.Execution getExecution(String project, String domain, String name); ExecutionOuterClass.ExecutionTerminateResponse terminateExecution(
      String project, String domain, String name, String cause); ExecutionOuterClass.ExecutionList listExecutions(
      String project,
      String domain,
      int limit,
      String token,
      String filters); ProjectOuterClass.Projects listProjects();  }
@Test public void shouldPropagateListExecutionToStub() { var listExecutions = flyteAdminClient.listExecutions(PROJECT, DOMAIN, 100, null, null); listExecutions.getExecutionsList().forEach( e -> { assertThat(e.getId().getProject(), equalTo(PROJECT)); assertThat(e.getId().getDomain(), equalTo(DOMAIN)); } ); assertThat(2, equalTo(listExecutions.getExecutionsCount())); }
@Test public void shouldReturnFirstPageWhenTokenIsNullOnListExecutions() { final var response = flyteAdminClient.listExecutions(PROJECT, DOMAIN, 100, null, null); final var executionNames = response.getExecutionsList().stream() .map(exec -> exec.getId().getName()) .collect(Collectors.toUnmodifiableList()); assertThat(executionNames, hasSize(PAGE_SIZE)); assertThat(executionNames, hasItems(EXEC_NAME_PREFIX + 1, EXEC_NAME_PREFIX + 2)); }
@Test public void shouldNotReturnTheFirstPageWhenTokenIsNotNullOnListExecutions() { final var response = flyteAdminClient.listExecutions(PROJECT, DOMAIN, 100, "1", null); final var executionNames = response.getExecutionsList().stream() .map(exec -> exec.getId().getName()) .collect(Collectors.toUnmodifiableList()); assertThat(executionNames, hasSize(PAGE_SIZE)); assertThat(executionNames, not(hasItems(EXEC_NAME_PREFIX + 1, EXEC_NAME_PREFIX + 2))); }
@Test public void shouldReturnPageWithFilteredExecutionsWhenFilterIsNotNullOnListExecutions() { final var response = flyteAdminClient.listExecutions(PROJECT, DOMAIN, 100, null, "remove-ods"); final var executionNames = response.getExecutionsList().stream() .map(exec -> exec.getId().getName()) .collect(Collectors.toUnmodifiableList()); assertThat(executionNames, hasItems(EXEC_NAME_PREFIX + 1, EXEC_NAME_PREFIX + 3)); }