Esempio n. 1
0
 def handle_composition(self, args: argparse.Namespace,
                        composition: mzcompose.Composition) -> None:
     if args.workflow not in composition.workflows:
         # Restart any dependencies whose definitions have changed. This is
         # Docker Compose's default behavior for `up`, but not for `run`,
         # which is a constant irritation that we paper over here. The trick,
         # taken from Buildkite's Docker Compose plugin, is to run an `up`
         # command that requests zero instances of the requested service.
         if args.workflow:
             composition.invoke(
                 "up",
                 "-d",
                 "--scale",
                 f"{args.workflow}=0",
                 args.workflow,
             )
         super().handle_composition(args, composition)
     else:
         # The user has specified a workflow rather than a service. Run the
         # workflow instead of Docker Compose.
         if args.unknown_args:
             bad_arg = args.unknown_args[0]
         elif args.unknown_subargs[0].startswith("-"):
             bad_arg = args.unknown_subargs[0]
         else:
             bad_arg = None
         if bad_arg:
             raise UIError(
                 f"unknown option {bad_arg!r}",
                 hint=f"if {bad_arg!r} is a valid Docker Compose option, "
                 f"it can't be used when running {args.workflow!r}, because {args.workflow!r} "
                 "is a custom mzcompose workflow, not a Docker Compose service",
             )
         composition.workflow(args.workflow, *args.unknown_subargs[1:])
Esempio n. 2
0
def workflow_load_test(c: Composition) -> None:
    """Run CH-benCHmark with a selected amount of load against Materialize."""
    c.workflow(
        "default",
        "--peek-conns=1",
        "--mz-views=q01,q02,q05,q06,q08,q09,q12,q14,q17,q19",
        "--transactional-threads=2",
    )
Esempio n. 3
0
def workflow_smoke_test(c: Composition) -> None:
    c.workflow(
        "default",
        "--num-seconds=15",
        "--records-per-second=1000",
    )
    c.kill("materialized")
    c.rm("materialized", "testdrive", "kafka", destroy_volumes=True)
    c.rm_volumes("mzdata", "pgdata")
Esempio n. 4
0
    def handle_composition(self, args: argparse.Namespace,
                           composition: mzcompose.Composition) -> None:
        if args.workflow not in composition.workflows:
            # Restart any dependencies whose definitions have changed. This is
            # Docker Compose's default behavior for `up`, but not for `run`,
            # which is a constant irritation that we paper over here. The trick,
            # taken from Buildkite's Docker Compose plugin, is to run an `up`
            # command that requests zero instances of the requested service.
            if args.workflow:
                composition.invoke(
                    "up",
                    "-d",
                    "--scale",
                    f"{args.workflow}=0",
                    args.workflow,
                )
            super().handle_composition(args, composition)
        else:
            # The user has specified a workflow rather than a service. Run the
            # workflow instead of Docker Compose.
            if args.unknown_args:
                bad_arg = args.unknown_args[0]
            elif args.unknown_subargs[0].startswith("-"):
                bad_arg = args.unknown_subargs[0]
            else:
                bad_arg = None
            if bad_arg:
                raise UIError(
                    f"unknown option {bad_arg!r}",
                    hint=f"if {bad_arg!r} is a valid Docker Compose option, "
                    f"it can't be used when running {args.workflow!r}, because {args.workflow!r} "
                    "is a custom mzcompose workflow, not a Docker Compose service",
                )

            # Run the workflow inside of a test case so that we get some basic
            # test analytics, even if the workflow doesn't define more granular
            # test cases.
            with composition.test_case(f"workflow-{args.workflow}"):
                composition.workflow(args.workflow, *args.unknown_subargs[1:])

            # Upload test report to Buildkite Test Analytics.
            junit_suite = junit_xml.TestSuite(composition.name)
            for (name, result) in composition.test_results.items():
                test_case = junit_xml.TestCase(name, composition.name,
                                               result.duration)
                if result.error:
                    test_case.add_error_info(message=result.error)
                junit_suite.test_cases.append(test_case)
            junit_report = ci_util.junit_report_filename("mzcompose")
            with junit_report.open("w") as f:
                junit_xml.to_xml_report_file(f, [junit_suite])
            ci_util.upload_junit_report("mzcompose", junit_report)

            if any(result.error
                   for result in composition.test_results.values()):
                raise UIError("at least one test case failed")
Esempio n. 5
0
def workflow_smoke_test(c: Composition) -> None:
    for arg in ["--upsert", "--enable-persistence"]:
        c.workflow(
            "default",
            "--num-seconds=15",
            "--records-per-second=1000",
            arg,
        )
        c.kill("materialized")
        c.rm("materialized", "testdrive-svc", "kafka", destroy_volumes=True)
        c.rm_volumes("mzdata")
Esempio n. 6
0
def workflow_testdrive_redpanda_ci(c: Composition) -> None:
    """Run testdrive against files known to be supported by Redpanda."""

    # https://github.com/vectorizedio/redpanda/issues/2397
    KNOWN_FAILURES = {"kafka-time-offset.td"}

    files = set(
        # NOTE(benesch): invoking the shell like this to filter testdrive files is
        # pretty gross. Let's not get into the habit of using this construction.
        spawn.capture(["sh", "-c", "grep -lr '\$.*kafka-ingest' *.td"],
                      cwd=Path(__file__).parent).split())
    files -= KNOWN_FAILURES
    c.workflow("default", "--redpanda", *files)
Esempio n. 7
0
def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
    for name in [
            "test-cluster",
            "test-github-12251",
            "test-github-13603",
            "test-remote-storaged",
            "test-drop-default-cluster",
            "test-upsert",
            "test-resource-limits",
            # Disabled to permit a breaking change.
            # See: https://materializeinc.slack.com/archives/C02FWJ94HME/p1661288774456699?thread_ts=1661288684.301649&cid=C02FWJ94HME
            # "test-builtin-migration",
            "pg-snapshot-resumption",
    ]:
        with c.test_case(name):
            c.workflow(name)
Esempio n. 8
0
def workflow_default(c: Composition) -> None:
    """All mzcompose files should contain a default workflow

    This workflow just runs all the other ones
    """
    c.workflow("start-confluents")
    c.workflow("versioned-mz")
    c.workflow("two-mz")
    c.workflow("mz-with-options")