Ejemplo n.º 1
0
  @Test
  public void testPartialDeleteWithEpochNumbers() throws Exception {
    copyResource(
        "acceptance/td/td_partial_delete/td_partial_delete_with_epoch_numbers.dig",
        projectDir.resolve("workflow.dig"));

    CommandStatus runStatus =
        main(
            "run",
            "-o",
            projectDir.toString(),
            "--config",
            config.toString(),
            "--project",
            projectDir.toString(),
            "-p",
            "outfile=" + outfile,
            "-p",
            "database=" + database,
            "-p",
            "table=" + table,
            "workflow.dig");

    assertThat(runStatus.errUtf8(), runStatus.code(), is(0));

    assertThat(Files.exists(outfile), is(true));

    // Verify that table contents are deleted
    String selectCountJobId =
        client.submit(TDJobRequest.newPrestoQuery(database, "select count(*) from " + table));
    TestUtils.expect(Duration.ofMinutes(5), jobSuccess(client, selectCountJobId));
    List<ArrayNode> result = downloadResult(selectCountJobId);
    assertThat(result.get(0).get(0).asInt(), is(0));
  }
Ejemplo n.º 2
0
  @Test
  public void verifyEnvVars() throws Exception {
    Files.write(
        config,
        ImmutableList.of(
            "secrets.my_secrets.d = secret-shared", "secrets.my_secrets.e = secret-only"));

    copyResource("acceptance/sh/env.dig", projectDir.resolve("workflow.dig"));

    CommandStatus runStatus =
        main(
            "run",
            "-o",
            projectDir.toString(),
            "--config",
            config.toString(),
            "--project",
            projectDir.toString(),
            "-p",
            "cmd=" + "command-line",
            "-p",
            "outfile=" + outfile,
            "workflow.dig");
    assertThat(runStatus.errUtf8(), runStatus.code(), is(0));

    assertThat(
        Files.readAllLines(outfile, UTF_8).get(0),
        is("exported 1 command-line secret-shared secret-only"));
  }
Ejemplo n.º 3
0
  @Test
  public void verifySecretOnlyAccess() throws Exception {
    copyResource("acceptance/sh/env_secret_only_reject.dig", projectDir.resolve("workflow.dig"));

    CommandStatus runStatus =
        main(
            "run",
            "-o",
            projectDir.toString(),
            "--config",
            config.toString(),
            "--project",
            projectDir.toString(),
            "workflow.dig");
    assertThat(runStatus.errUtf8(), runStatus.code(), not(is(0)));

    assertThat(runStatus.errUtf8(), containsString("Secret not found"));
  }