-
Notifications
You must be signed in to change notification settings - Fork 1
Tests
Tests exist for purposes of tracking regressions introduced by new changes by several developers. They are a tool to measure the stability and correctness of the RDFS codebase.
Tests will use the Google Test framework.
- New tests should be placed in the
~/rdfs/testdirectory. - Modify
CMakeLists.txtto create an executable to run the test. - Modify
.ci/test/main.shto invoke the test executable. Keep it alphabetized.
If you add a new test, please tag a reviewer on the blame here.
- Build the project.
cd build/test./TestExecutableName
Push a commit to your feature/bug development branch. CI will automatically run all tests in
.ci/test/main.sh in a fresh environment.
A beginner's guide to using Google Test is located here.
Run the namenode executable from build/rice-namenode.
Then run something like hdfs dfs -fs hdfs://localhost:port/ -mkdir foo
where port is the port used by the namenode (it will print the port used)
Run the datanode executable from build/rice-datanode.
Then run something like hdfs dfsadmin -shutdownDatanode hdfs://localhost:port/
where port is the port used by the datanode (it will print the port used)
- Pull the code and build (as explained above).
- Run zookeeper (from ~, it’s
sudo zookeeper/bin/zkServer.sh start). This will run in the background. - Run namenode (
rdfs/build/rice-namenode/namenode). This will run in the foreground. - Run datanode (
rdfs/build/rice-datanode/datanode). This will run in the foreground. - Create a file with
hdfs dfs -fs hdfs://localhost:5351 -copyFromLocal localFile /filename - Try to cat that file with
hdfs dfs -fs hdfs://localhost:5351 -cat /filename
Google Mock should be used in conjunction with Google Test.
Google Mock is not a testing framework, but a framework for writing C++ mock
classes. A mock class is simplified version of a real class that can be
created to aid with testing. However, Google Mock does do an automatic
verification of expectations.
The typical flow is:
-
Import the Google Mock names you need to use. All Google Mock names are in the
testingnamespace unless they are macros or otherwise noted. -
Create the mock objects.
-
Optionally, set the default actions of the mock objects.
-
Set your expectations on the mock objects (How will they be called? What will they do?).
-
Exercise code that uses the mock objects; if necessary, check the result using Google Test assertions.
-
When a mock objects is destructed, Google Mock automatically verifies that all expectations on it have been satisfied.
You should read through all of the Google Mock documentation located at (/googletest/googlemock/docs/) before using it:
- ForDummies -- start here if you are new to Google Mock.
- CheatSheet -- a quick reference.
- CookBook -- recipes for doing various tasks using Google Mock.
Rice University COMP 413 2017
RDFS Overview
Development
Workflow
Style