You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/04/28 12:35:24 UTC

[GitHub] [cassandra] adelapena opened a new pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

adelapena opened a new pull request #988:
URL: https://github.com/apache/cassandra/pull/988


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] adelapena commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
adelapena commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628403228



##########
File path: doc/source/development/testing.rst
##########
@@ -93,6 +93,28 @@ Another tool available on github is `cstar_perf <https://github.com/datastax/cst
 
 CircleCI
 --------
-Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``
+Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``.
+
+The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information.
+
+The optional ``repeated_utest``/``repeated_dtest`` CircleCI jobs run a specific JUnit/Python test repeatedly. This is useful to verify that a certain test is stable. It's usually a good idea to run these jobs when adding or modifying a test. To specify what test should be run and the number of repetitions you should edit the related evironment variables in the CircleCI configuration file:
+
++----------------------------+-------------------------------------------------------------------------+
+| Variable                   | Description                                                             |
++============================+=========================================================================+
+| ``REPEATED_UTEST_TARGET``  | The Ant test target to run                                              |
++----------------------------+-------------------------------------------------------------------------+
+| ``REPEATED_UTEST_CLASS``   | The name of JUnit class to be run multiple times                        |
++----------------------------+-------------------------------------------------------------------------+

Review comment:
       I have used "Java" instead. I have also added some examples and changed the header level of the CircleCI section.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] ekaterinadimitrova2 commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
ekaterinadimitrova2 commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628230075



##########
File path: doc/source/development/testing.rst
##########
@@ -93,6 +93,28 @@ Another tool available on github is `cstar_perf <https://github.com/datastax/cst
 
 CircleCI
 --------
-Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``
+Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``.
+
+The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information.
+
+The optional ``repeated_utest``/``repeated_dtest`` CircleCI jobs run a specific JUnit/Python test repeatedly. This is useful to verify that a certain test is stable. It's usually a good idea to run these jobs when adding or modifying a test. To specify what test should be run and the number of repetitions you should edit the related evironment variables in the CircleCI configuration file:
+
++----------------------------+-------------------------------------------------------------------------+
+| Variable                   | Description                                                             |
++============================+=========================================================================+
+| ``REPEATED_UTEST_TARGET``  | The Ant test target to run                                              |
++----------------------------+-------------------------------------------------------------------------+
+| ``REPEATED_UTEST_CLASS``   | The name of JUnit class to be run multiple times                        |
++----------------------------+-------------------------------------------------------------------------+

Review comment:
       Instead of JUnit I would probably still use UTest class or so

##########
File path: doc/source/development/testing.rst
##########
@@ -93,6 +93,28 @@ Another tool available on github is `cstar_perf <https://github.com/datastax/cst
 
 CircleCI
 --------
-Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``
+Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``.
+
+The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information.
+
+The optional ``repeated_utest``/``repeated_dtest`` CircleCI jobs run a specific JUnit/Python test repeatedly. This is useful to verify that a certain test is stable. It's usually a good idea to run these jobs when adding or modifying a test. To specify what test should be run and the number of repetitions you should edit the related evironment variables in the CircleCI configuration file:
+
++----------------------------+-------------------------------------------------------------------------+
+| Variable                   | Description                                                             |
++============================+=========================================================================+
+| ``REPEATED_UTEST_TARGET``  | The Ant test target to run                                              |
++----------------------------+-------------------------------------------------------------------------+
+| ``REPEATED_UTEST_CLASS``   | The name of JUnit class to be run multiple times                        |
++----------------------------+-------------------------------------------------------------------------+
+| ``REPEATED_UTEST_METHODS`` | The optional specific methods within ``REPEATED_UTEST_CLASS`` to be run |
++----------------------------+-------------------------------------------------------------------------+
+| ``REPEATED_UTEST_COUNT``   | The number of times that the repeated JUnit test should be run          |

Review comment:
       same here

##########
File path: doc/source/development/testing.rst
##########
@@ -93,6 +93,28 @@ Another tool available on github is `cstar_perf <https://github.com/datastax/cst
 
 CircleCI
 --------
-Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``
+Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``.
+
+The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information.

Review comment:
       I would probably add a sentence that the higher resources are not available in the free tier. Even if those files are used, the resources will be lowered as the respective account doesn't have credits. As otherwise people probably will try using the higher resources and only after that realize they can't. We can probably save them some time and disappointment :-)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] adelapena commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
adelapena commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628179096



##########
File path: .circleci/config-2_1.yml
##########
@@ -1102,3 +1203,164 @@ commands:
       - store_artifacts:
           path: ~/cassandra-dtest/logs
           destination: dtest_<<parameters.file_tag>>_logs
+
+  run_repeated_utest:
+    steps:
+      - run:
+          name: Run repeated utest
+          no_output_timeout: 15m
+          command: |
+            if [ "$REPEATED_UTEST_CLASS" == "<nil>" ]; then
+              echo "Repeated utest class name hasn't been defined, exiting without running any test"
+            elif [ "$REPEATED_UTEST_COUNT" == "<nil>" ]; then
+              echo "Repeated utest count hasn't been defined, exiting without running any test"
+            elif [ "$REPEATED_UTEST_COUNT" -le 0 ]; then
+              echo "Repeated utest count is lesser or equals than zero, exiting without running any test"
+            else
+            
+              # Calculate the number of test iterations to be run by the current parallel runner.
+              # Since we are running the same test multiple times there is no need to use `circleci tests split`.
+              count=$((REPEATED_UTEST_COUNT / CIRCLE_NODE_TOTAL))
+              if (($CIRCLE_NODE_INDEX < (REPEATED_UTEST_COUNT % CIRCLE_NODE_TOTAL))); then
+                count=$((count+1))
+              fi
+
+              if (($count <= 0)); then
+                echo "No tests to run in this runner"
+              else
+                echo "Running $REPEATED_UTEST_TARGET $REPEATED_UTEST_CLASS $REPEATED_UTEST_METHODS $count times"
+
+                set -x
+                export PATH=$JAVA_HOME/bin:$PATH
+                time mv ~/cassandra /tmp
+                cd /tmp/cassandra
+                if [ -d ~/dtest_jars ]; then
+                  cp ~/dtest_jars/dtest* /tmp/cassandra/build/
+                fi
+
+                target=$REPEATED_UTEST_TARGET
+                class_path=$REPEATED_UTEST_CLASS
+                class_name="${class_path##*.}"
+
+                # Prepare the -Dtest.name argument.
+                # It can be the fully qualified class name or the short class name, depending on the target.
+                if [[ $target == "test" || \
+                      $target == "test-cdc" || \
+                      $target == "test-compression" || \
+                      $target == "test-system-keyspace-directory" ]]; then
+                  name="-Dtest.name=$class_name"
+                else
+                  name="-Dtest.name=$class_path"
+                fi
+
+                # Prepare the -Dtest.methods argument, which is optional
+                if [ "$REPEATED_UTEST_METHODS" == "<nil>" ]; then
+                  methods=""
+                else
+                  methods="-Dtest.methods=$REPEATED_UTEST_METHODS"
+                fi
+
+                # Run the test target as many times as requested, even if it fails, collecting the exit code.
+                exit_code="$?"
+                for i in $(seq -w 1 $count); do
+
+                  echo "Running test iteration $i of $count"
+
+                  # run the test
+                  status="passes"
+                  if !( set -o pipefail && ant $target $name $methods -Dno-build-test=true | tee stdout.txt ); then
+                    status="fails"
+                    exit_code=1
+                  fi
+
+                  # move the stdout output file
+                  dest=/tmp/results/repeated_utest/stdout/${status}/${i}
+                  mkdir -p $dest
+                  mv stdout.txt $dest/${REPEATED_UTEST_TARGET}-${REPEATED_UTEST_CLASS}.txt
+
+                  # move the XML output files
+                  source=build/test/output
+                  dest=/tmp/results/repeated_utest/output/${status}/${i}
+                  mkdir -p $dest
+                  if [[ -d $source && -n "$(ls $source)" ]]; then
+                    mv $source/* $dest/
+                  fi
+
+                  # move the log files
+                  source=build/test/logs
+                  dest=/tmp/results/repeated_utest/logs/${status}/${i}
+                  mkdir -p $dest
+                  if [[ -d $source && -n "$(ls $source)" ]]; then
+                    mv $source/* $dest/
+                  fi
+                done
+
+                (exit ${exit_code})
+              fi
+            fi
+      - store_test_results:
+          path: /tmp/results/repeated_utest/output/

Review comment:
       I think we don't, removed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] adelapena commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
adelapena commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628178865



##########
File path: .circleci/readme.md
##########
@@ -51,5 +53,7 @@ HIGHRES files, read below for details how to do it manually;
    the patch file based on the diff (don't commit it though).
 1. generate the HIGHRES file:
    `circleci config process config-2_1.yml.HIGHRES > config.yml.HIGHRES`
+1. add the Apache license header to the newly created LOWRES file:
+   `cat license.yml config.yml.HIGHRES > config.yml.HIGHRES.new && mv config.yml.HIGHRES.new config.yml.HIGHRES`
 1. and remove the temporary patched HIGHRES file: `rm config-2_1.yml.HIGHRES`
 

Review comment:
       Good idea, added.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] adelapena closed pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
adelapena closed pull request #988:
URL: https://github.com/apache/cassandra/pull/988


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] ekaterinadimitrova2 commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
ekaterinadimitrova2 commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628405690



##########
File path: doc/source/development/testing.rst
##########
@@ -93,6 +93,28 @@ Another tool available on github is `cstar_perf <https://github.com/datastax/cst
 
 CircleCI
 --------
-Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``
+Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``.
+
+The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information.
+
+The optional ``repeated_utest``/``repeated_dtest`` CircleCI jobs run a specific JUnit/Python test repeatedly. This is useful to verify that a certain test is stable. It's usually a good idea to run these jobs when adding or modifying a test. To specify what test should be run and the number of repetitions you should edit the related evironment variables in the CircleCI configuration file:
+
++----------------------------+-------------------------------------------------------------------------+
+| Variable                   | Description                                                             |
++============================+=========================================================================+
+| ``REPEATED_UTEST_TARGET``  | The Ant test target to run                                              |
++----------------------------+-------------------------------------------------------------------------+
+| ``REPEATED_UTEST_CLASS``   | The name of JUnit class to be run multiple times                        |
++----------------------------+-------------------------------------------------------------------------+

Review comment:
       Thank you for doing it! Looks great!




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] ekaterinadimitrova2 commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
ekaterinadimitrova2 commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628188433



##########
File path: .circleci/readme.md
##########
@@ -51,5 +53,7 @@ HIGHRES files, read below for details how to do it manually;
    the patch file based on the diff (don't commit it though).
 1. generate the HIGHRES file:
    `circleci config process config-2_1.yml.HIGHRES > config.yml.HIGHRES`
+1. add the Apache license header to the newly created LOWRES file:
+   `cat license.yml config.yml.HIGHRES > config.yml.HIGHRES.new && mv config.yml.HIGHRES.new config.yml.HIGHRES`
 1. and remove the temporary patched HIGHRES file: `rm config-2_1.yml.HIGHRES`
 

Review comment:
       Thank you :-) 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] ekaterinadimitrova2 commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
ekaterinadimitrova2 commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r626997692



##########
File path: .circleci/generate.sh
##########
@@ -19,17 +19,22 @@
 
 BASEDIR=`dirname $0`
 
-circleci config process $BASEDIR/config-2_1.yml > $BASEDIR/config.yml.LOWRES
+# setup lowres
+circleci config process $BASEDIR/config-2_1.yml > $BASEDIR/config.yml.LOWRES.tmp
+cat $BASEDIR/license.yml $BASEDIR/config.yml.LOWRES.tmp > $BASEDIR/config.yml.LOWRES

Review comment:
       Good catch, thanks!

##########
File path: .circleci/readme.md
##########
@@ -51,5 +53,7 @@ HIGHRES files, read below for details how to do it manually;
    the patch file based on the diff (don't commit it though).
 1. generate the HIGHRES file:
    `circleci config process config-2_1.yml.HIGHRES > config.yml.HIGHRES`
+1. add the Apache license header to the newly created LOWRES file:
+   `cat license.yml config.yml.HIGHRES > config.yml.HIGHRES.new && mv config.yml.HIGHRES.new config.yml.HIGHRES`
 1. and remove the temporary patched HIGHRES file: `rm config-2_1.yml.HIGHRES`
 

Review comment:
       I was wondering can we add a comment the same steps apply for MIDRES, I thought I added it already before but seems I missed it. :( It seems obvious, but let's think for someone new, to remind them not to miss the MIDRES one to update it. WDYT?

##########
File path: .circleci/config-2_1.yml
##########
@@ -1102,3 +1203,164 @@ commands:
       - store_artifacts:
           path: ~/cassandra-dtest/logs
           destination: dtest_<<parameters.file_tag>>_logs
+
+  run_repeated_utest:
+    steps:
+      - run:
+          name: Run repeated utest
+          no_output_timeout: 15m
+          command: |
+            if [ "$REPEATED_UTEST_CLASS" == "<nil>" ]; then
+              echo "Repeated utest class name hasn't been defined, exiting without running any test"
+            elif [ "$REPEATED_UTEST_COUNT" == "<nil>" ]; then
+              echo "Repeated utest count hasn't been defined, exiting without running any test"
+            elif [ "$REPEATED_UTEST_COUNT" -le 0 ]; then
+              echo "Repeated utest count is lesser or equals than zero, exiting without running any test"
+            else
+            
+              # Calculate the number of test iterations to be run by the current parallel runner.
+              # Since we are running the same test multiple times there is no need to use `circleci tests split`.
+              count=$((REPEATED_UTEST_COUNT / CIRCLE_NODE_TOTAL))
+              if (($CIRCLE_NODE_INDEX < (REPEATED_UTEST_COUNT % CIRCLE_NODE_TOTAL))); then
+                count=$((count+1))
+              fi
+
+              if (($count <= 0)); then
+                echo "No tests to run in this runner"
+              else
+                echo "Running $REPEATED_UTEST_TARGET $REPEATED_UTEST_CLASS $REPEATED_UTEST_METHODS $count times"
+
+                set -x
+                export PATH=$JAVA_HOME/bin:$PATH
+                time mv ~/cassandra /tmp
+                cd /tmp/cassandra
+                if [ -d ~/dtest_jars ]; then
+                  cp ~/dtest_jars/dtest* /tmp/cassandra/build/
+                fi
+
+                target=$REPEATED_UTEST_TARGET
+                class_path=$REPEATED_UTEST_CLASS
+                class_name="${class_path##*.}"
+
+                # Prepare the -Dtest.name argument.
+                # It can be the fully qualified class name or the short class name, depending on the target.
+                if [[ $target == "test" || \
+                      $target == "test-cdc" || \
+                      $target == "test-compression" || \
+                      $target == "test-system-keyspace-directory" ]]; then
+                  name="-Dtest.name=$class_name"
+                else
+                  name="-Dtest.name=$class_path"
+                fi
+
+                # Prepare the -Dtest.methods argument, which is optional
+                if [ "$REPEATED_UTEST_METHODS" == "<nil>" ]; then
+                  methods=""
+                else
+                  methods="-Dtest.methods=$REPEATED_UTEST_METHODS"
+                fi
+
+                # Run the test target as many times as requested, even if it fails, collecting the exit code.
+                exit_code="$?"
+                for i in $(seq -w 1 $count); do
+
+                  echo "Running test iteration $i of $count"
+
+                  # run the test
+                  status="passes"
+                  if !( set -o pipefail && ant $target $name $methods -Dno-build-test=true | tee stdout.txt ); then
+                    status="fails"
+                    exit_code=1
+                  fi
+
+                  # move the stdout output file
+                  dest=/tmp/results/repeated_utest/stdout/${status}/${i}
+                  mkdir -p $dest
+                  mv stdout.txt $dest/${REPEATED_UTEST_TARGET}-${REPEATED_UTEST_CLASS}.txt
+
+                  # move the XML output files
+                  source=build/test/output
+                  dest=/tmp/results/repeated_utest/output/${status}/${i}
+                  mkdir -p $dest
+                  if [[ -d $source && -n "$(ls $source)" ]]; then
+                    mv $source/* $dest/
+                  fi
+
+                  # move the log files
+                  source=build/test/logs
+                  dest=/tmp/results/repeated_utest/logs/${status}/${i}
+                  mkdir -p $dest
+                  if [[ -d $source && -n "$(ls $source)" ]]; then
+                    mv $source/* $dest/
+                  fi
+                done
+
+                (exit ${exit_code})
+              fi
+            fi
+      - store_test_results:
+          path: /tmp/results/repeated_utest/output/

Review comment:
       do we need really the last `/`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra] adelapena commented on a change in pull request #988: CASSANDRA-16625 (trunk): Add a CircleCI job to run some tests repeatedly

Posted by GitBox <gi...@apache.org>.
adelapena commented on a change in pull request #988:
URL: https://github.com/apache/cassandra/pull/988#discussion_r628241389



##########
File path: doc/source/development/testing.rst
##########
@@ -93,6 +93,28 @@ Another tool available on github is `cstar_perf <https://github.com/datastax/cst
 
 CircleCI
 --------
-Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``
+Cassandra ships with a default `CircleCI <https://circleci.com>`_ configuration, to enable running tests on your branches, you need to go the CircleCI website, click "Login" and log in with your github account. Then you need to give CircleCI permission to watch your repositories. Once you have done that, you can optionally configure CircleCI to run tests in parallel - click "Projects", then your github account and then click the settings for the project. If you leave the parallelism at 1 for Cassandra, only ``ant eclipse-warnings`` and ``ant test`` will be run. If you up the parallelism to 4, it also runs ``ant long-test``, ``ant test-compression`` and ``ant stress-test``.
+
+The configuration for CircleCI is in the ``.circleci/config.yml`` file. This configuration file is meant to use low resources, you can find equivalent configuration files using more resources in the same ``.circleci`` directory. Please read the ``readme.md`` file in that directory for further information.

Review comment:
       +1, done




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org