Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation added for testing #1281

Merged
merged 18 commits into from
Dec 9, 2020
Merged

Conversation

razajafri
Copy link
Collaborator

This PR starts the process of improving our documentation for running integration and unit-tests

This addresses #814

Signed-off-by: Raza Jafri <rjafri@nvidia.com>
@razajafri
Copy link
Collaborator Author

@sameerz PTAL

@sameerz sameerz added the documentation Improvements or additions to documentation label Dec 4, 2020
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
razajafri and others added 4 commits December 4, 2020 17:54
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
Addressed review comments
minor change to the example and fixed a broken link
@razajafri
Copy link
Collaborator Author

build

1 similar comment
@GaryShen2008
Copy link
Collaborator

build

@razajafri
Copy link
Collaborator Author

build

- To run test ParquetWriterSuite in package com.nvidia.spark.rapids, issue `mvn test -DwildcardSuites="com.nvidia.spark.rapids.ParquetWriterSuite"`


#### Integration tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so there is already documentation in integration_tests.md do we really need this in both places? or just have a link and put the details in that doc

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have us link to it. There is also documentation about unit tests

https://github.com/NVIDIA/spark-rapids/blob/branch-0.3/docs/testing.md

Not sure why we are not linking to that primarily and updating it as needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will link to the testing doc and update if needed. I honestly wasn't aware we have a document already, thanks for bringing it up

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still confused, why do we have so many different docs for testing. I realize you linked them but now there is info in testing.md and integrationtest.md . We added information here on running but I need to go to integration tests readme.md to know what i need to install to add it. why don't we put all information in the integration test readme and test readme and just have small description and point to those? Maybe i'm missing something @revans2 @jlowe opinions?

better insight into what is needed as we constantly keep working on to improve and expand the plugin-support.

The tests are written python and run with pytest and the script honors pytest parameters. Some handy flags are:
- `-k` <pytest-file-name>. This will run all the tests in that test file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I haven't tried this, usually I specify the path to the test file to run all tests in a file. I supposed both works? or is this specific to the run_pyspark_from_build.sh script? I have been doing spark-submit way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-k does a test search for the name of the test. This includes the file name and the extensions for specific parameters. I prefer -k because I can do things like -k Decimal and I will typically end up running all of the tests that touch the decimal type either as a parameter or something else.

But it would be good to document both ways.

- `-k` <pytest-file-name>. This will run all the tests in that test file.
- `-k` <test-name>. This will also run an individual test.
- `-s` Doesn't capture the output and instead prints to the screen.
- `-v` increase verbosity of the tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps add the debug tmp path option that save the output

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you referring to --debug? This option doesn't accept path. Are you referring to some other option?

@@ -0,0 +1,44 @@
### Testing your code
There are two types of tests in this project. Unit tests that are written in Scala, and integration tests that are written in Python.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually have integration tests in both Scala and python.

- To run test ParquetWriterSuite in package com.nvidia.spark.rapids, issue `mvn test -DwildcardSuites="com.nvidia.spark.rapids.ParquetWriterSuite"`


#### Integration tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to have us link to it. There is also documentation about unit tests

https://github.com/NVIDIA/spark-rapids/blob/branch-0.3/docs/testing.md

Not sure why we are not linking to that primarily and updating it as needed.

better insight into what is needed as we constantly keep working on to improve and expand the plugin-support.

The tests are written python and run with pytest and the script honors pytest parameters. Some handy flags are:
- `-k` <pytest-file-name>. This will run all the tests in that test file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-k does a test search for the name of the test. This includes the file name and the extensions for specific parameters. I prefer -k because I can do things like -k Decimal and I will typically end up running all of the tests that touch the decimal type either as a parameter or something else.

But it would be good to document both ways.

@razajafri
Copy link
Collaborator Author

build

@razajafri
Copy link
Collaborator Author

build

@razajafri
Copy link
Collaborator Author

@tgravescs @revans2 I have addressed your concerns PTAL

docs/testing.md Outdated
@@ -39,20 +39,54 @@ They generally follow TPCH but are not guaranteed to be the same.

## Unit tests

Unit tests exist in the tests directory. This is unconventional and is done so we can run the tests
on the final shaded version of the plugin. It also helps with how we collect code coverage.
Unit tests exist in the [here](tests) directory. This is unconventional and is done so we can run
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"unit tests exist in the here directory" is not very readable. Also not sure why you are linking to. There is no tests directory or file under docs that this can or should link to.

docs/testing.md Outdated
Unit tests exist in the [here](tests) directory. This is unconventional and is done so we can run
the tests on the final shaded version of the plugin. It also helps with how we collect code coverage.

in order to run the unit-tests follow these steps
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please capitalize sentences.

docs/testing.md Outdated

in order to run the unit-tests follow these steps
1. issue the maven command to run the tests with `mvn test`. this will run all the tests
2. to run individual tests append `-dwildcardsuites=<comma separated list of wildcard suite names to execute>` to the above command
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not steps. They are options and I don't think we need a list to express them.

docs/testing.md Outdated
1. issue the maven command to run the tests with `mvn test`. this will run all the tests
2. to run individual tests append `-dwildcardsuites=<comma separated list of wildcard suite names to execute>` to the above command

for more information about using scalatest with maven please refere [here](https://www.scalatest.org/user_guide/using_the_scalatest_maven_plugin)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not known for my spelling but I don't think refer has an "e" at the end

docs/testing.md Outdated
There are two frameworks used for testing. One is based off of pytest and pyspark in the
`src/main/python` directory. These tests will run as a part of the maven build if you have the environment
variable `SPARK_HOME` set.
Integration tests are stored in the [integration_tests](integration_tests) directory.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not in the right directory for this link to work. Please change it back to the README or at least ../integration_tests

docs/testing.md Outdated
@@ -117,3 +151,12 @@ Next you can start to run the tests.
durations.run(new com.nvidia.spark.rapids.JoinsSuite)
...
```

For more details on Integration tests options please refer to integration-test [doc](integration-tests/README.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to test out the links I don't think this works.

@razajafri
Copy link
Collaborator Author

@revans2 better now? The links were all copied from where I added this section originally in the CONTRIBUTING.md.

Thanks for reviewing

@razajafri
Copy link
Collaborator Author

build

docs/testing.md Outdated

In order to run the unit-tests issue the maven command to run the tests i.e. `mvn test`.

To run individual tests append `-DwildcardSuites=<comma separated list of wildcard suite names to execute>` to the above command
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work for both scala and java tests? I know the java ones are different in spark

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wildcardSuites only applies to scalatest. Java tests need to be filtered via surefire's approach which is -Dtest=...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right so we have a java test right - TestHashedPriorityQueue.java? so adding how to run it would be useful and specifying here this works for scala tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this text is old new one mentions scala tests

- To run test ParquetWriterSuite in package com.nvidia.spark.rapids, issue `mvn test -DwildcardSuites="com.nvidia.spark.rapids.ParquetWriterSuite"`


#### Integration tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still confused, why do we have so many different docs for testing. I realize you linked them but now there is info in testing.md and integrationtest.md . We added information here on running but I need to go to integration tests readme.md to know what i need to install to add it. why don't we put all information in the integration test readme and test readme and just have small description and point to those? Maybe i'm missing something @revans2 @jlowe opinions?

docs/testing.md Outdated Show resolved Hide resolved
docs/testing.md Outdated Show resolved Hide resolved
docs/testing.md Outdated
Unit tests exist in the [tests](../tests) directory. This is unconventional and is done so we can
run the tests on the final shaded version of the plugin. It also helps with how we collect code coverage.

In order to run the unit-tests issue the maven command to run the tests i.e. `mvn test`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to run the unit-tests issue the maven command to run the tests i.e. `mvn test`.
Use Maven to run the unit tests via `mvn test`.

docs/testing.md Outdated

In order to run the unit-tests issue the maven command to run the tests i.e. `mvn test`.

To run individual tests append `-DwildcardSuites=<comma separated list of wildcard suite names to execute>` to the above command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wildcardSuites only applies to scalatest. Java tests need to be filtered via surefire's approach which is -Dtest=...

docs/testing.md Outdated Show resolved Hide resolved
docs/testing.md Outdated Show resolved Hide resolved
docs/testing.md Outdated
apache spark specific configurations can be passed in by setting environment-variable spark_conf

Examples:
-To run tests against Apache Spark 3.1.0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says it will run tests against Spark 3.1.0 but only runs one test. Either fix the description or fix the example.

docs/testing.md Outdated Show resolved Hide resolved
@jlowe
Copy link
Member

jlowe commented Dec 8, 2020

why don't we put all information in the integration test readme and test readme and just have small description and point to those?

I'm all for not repeating information across the various docs and instead linking. I agree we should keep unit test info to the unit test docs and integration test info to the integration test docs. Each doc can reference the other for more information on running the unit tests vs. integration tests.

@revans2
Copy link
Collaborator

revans2 commented Dec 8, 2020

I'm all for not repeating information across the various docs and instead linking. I agree we should keep unit test info to the unit test docs and integration test info to the integration test docs. Each doc can reference the other for more information on running the unit tests vs. integration tests.

I'm not a big fan of pointing things from the docs directory outside of it, simply because the docs directory gets moved around when it becomes the github pages site. But because this is docs for developers I think @jlowe is right and we should have it all in the README for the various directories with links to them, so long as we are careful to make sure that the links work on the github pages site and in markdown.

@razajafri
Copy link
Collaborator Author

@revans2 @tgravescs @jlowe

Sorry about the back and forth. I have incorporated all the suggestions I think. Please check if this looks good. I have also added a section on the project README.md for tests and linked it to tests/README.md. Let me know if that looks good

@razajafri
Copy link
Collaborator Author

build

@razajafri
Copy link
Collaborator Author

build

@razajafri
Copy link
Collaborator Author

@revans2 @tgravescs do you have any other suggestions or does this look OK to go in?

CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
tests/README.md Outdated Show resolved Hide resolved
tests/README.md Outdated Show resolved Hide resolved
tests/README.md Outdated Show resolved Hide resolved
tests/README.md Outdated Show resolved Hide resolved
razajafri and others added 6 commits December 9, 2020 09:48
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
@razajafri
Copy link
Collaborator Author

build

@razajafri
Copy link
Collaborator Author

@jlowe thanks for the suggestions. They have all been applied. Please take another look

Copy link
Member

@jlowe jlowe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK to me, but @revans2 and @tgravescs should comment before merging.

Copy link
Collaborator

@tgravescs tgravescs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall is fine, I think we have one java unit test that we could say how to run individually but not a big deal

@razajafri
Copy link
Collaborator Author

Thanks, @tgravescs I have created a follow-on #1345

@razajafri razajafri merged commit 714b063 into NVIDIA:branch-0.3 Dec 9, 2020
@razajafri razajafri deleted the doc_updated branch December 9, 2020 19:16
@sameerz sameerz added this to the Dec 7 - Dec 18 milestone Dec 26, 2020
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* documentation added for testing

Signed-off-by: Raza Jafri <rjafri@nvidia.com>

* Capitalize word

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update CONTRIBUTING.md

Addressed review comments

* Update CONTRIBUTING.md

minor change to the example and fixed a broken link

* created a separate document for testing

* addressed review comments

* minor fix

* fixed broken links and capitalization

* addressed review comments

* fix broken link

* exclude README.md from rat

* Update CONTRIBUTING.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update CONTRIBUTING.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

Co-authored-by: Raza Jafri <rjafri@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
nartal1 pushed a commit to nartal1/spark-rapids that referenced this pull request Jun 9, 2021
* documentation added for testing

Signed-off-by: Raza Jafri <rjafri@nvidia.com>

* Capitalize word

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update CONTRIBUTING.md

Addressed review comments

* Update CONTRIBUTING.md

minor change to the example and fixed a broken link

* created a separate document for testing

* addressed review comments

* minor fix

* fixed broken links and capitalization

* addressed review comments

* fix broken link

* exclude README.md from rat

* Update CONTRIBUTING.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update CONTRIBUTING.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

* Update tests/README.md

Co-authored-by: Jason Lowe <jlowe@nvidia.com>

Co-authored-by: Raza Jafri <rjafri@nvidia.com>
Co-authored-by: Jason Lowe <jlowe@nvidia.com>
tgravescs pushed a commit to tgravescs/spark-rapids that referenced this pull request Nov 30, 2023
Signed-off-by: Tim Liu <timl@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants