github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/cmd/roachtest/flowable.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package main
    12  
    13  import (
    14  	"context"
    15  	"regexp"
    16  )
    17  
    18  var flowableReleaseTagRegex = regexp.MustCompile(`^flowable-(?P<major>\d+)\.(?P<minor>\d+)\.(?P<point>\d+)$`)
    19  
    20  // This test runs Flowable test suite against a single cockroach node.
    21  
    22  func registerFlowable(r *testRegistry) {
    23  	runFlowable := func(
    24  		ctx context.Context,
    25  		t *test,
    26  		c *cluster,
    27  	) {
    28  		if c.isLocal() {
    29  			t.Fatal("cannot be run in local mode")
    30  		}
    31  		node := c.Node(1)
    32  		t.Status("setting up cockroach")
    33  		c.Put(ctx, cockroach, "./cockroach", c.All())
    34  		c.Start(ctx, t, c.All())
    35  
    36  		t.Status("cloning flowable and installing prerequisites")
    37  		latestTag, err := repeatGetLatestTag(
    38  			ctx, c, "flowable", "flowable-engine", flowableReleaseTagRegex,
    39  		)
    40  		if err != nil {
    41  			t.Fatal(err)
    42  		}
    43  		t.l.Printf("Latest Flowable release is %s.", latestTag)
    44  
    45  		if err := repeatRunE(
    46  			ctx, c, node, "update apt-get", `sudo apt-get -qq update`,
    47  		); err != nil {
    48  			t.Fatal(err)
    49  		}
    50  
    51  		if err := repeatRunE(
    52  			ctx,
    53  			c,
    54  			node,
    55  			"install dependencies",
    56  			`sudo apt-get -qq install default-jre openjdk-8-jdk-headless gradle maven`,
    57  		); err != nil {
    58  			t.Fatal(err)
    59  		}
    60  
    61  		if err := repeatRunE(
    62  			ctx, c, node, "remove old Flowable", `rm -rf /mnt/data1/flowable-engine`,
    63  		); err != nil {
    64  			t.Fatal(err)
    65  		}
    66  
    67  		if err := repeatGitCloneE(
    68  			ctx,
    69  			t.l,
    70  			c,
    71  			"https://github.com/flowable/flowable-engine.git",
    72  			"/mnt/data1/flowable-engine",
    73  			latestTag,
    74  			node,
    75  		); err != nil {
    76  			t.Fatal(err)
    77  		}
    78  
    79  		t.Status("building Flowable")
    80  		if err := repeatRunE(
    81  			ctx,
    82  			c,
    83  			node,
    84  			"building Flowable",
    85  			`cd /mnt/data1/flowable-engine/ && mvn clean install -DskipTests`,
    86  		); err != nil {
    87  			t.Fatal(err)
    88  		}
    89  
    90  		if err := c.RunE(ctx, node,
    91  			`cd /mnt/data1/flowable-engine/ && mvn clean test -Dtest=Flowable6Test#testLongServiceTaskLoop -Ddb=crdb`,
    92  		); err != nil {
    93  			t.Fatal(err)
    94  		}
    95  	}
    96  
    97  	r.Add(testSpec{
    98  		Name:       "flowable",
    99  		Owner:      OwnerAppDev,
   100  		Cluster:    makeClusterSpec(1),
   101  		MinVersion: "v19.1.0",
   102  		Run: func(ctx context.Context, t *test, c *cluster) {
   103  			runFlowable(ctx, t, c)
   104  		},
   105  	})
   106  }