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

GEODE-4921: Initial revision of new testing framework. #249

Merged
merged 8 commits into from Mar 29, 2018

Conversation

jake-at-work
Copy link
Contributor

  • Single process.
  • Easy to debug from IDE.
  • No environment variables required to run.
  • Uses GTest as base framework.

- Single process.
- Easy to debug from IDE.
- No environment variables required to run.
- Uses GTest as base framework.
@dgkimura
Copy link
Member

Wow, really nice to see this!

Are there any particular areas you're looking for review? I intend to make some time to take a look over the weekend.

@jake-at-work
Copy link
Contributor Author

Not looking for anything particularly other than if this a good a starting point. Intentionally didn’t try to flush out the whole framework. I expect this will mature and evolve as needed.

@jake-at-work
Copy link
Contributor Author

Looks like I still have some issues on Solaris and Linux. This should be working great on Windows and MacOS. Will close until I get those resolved.

@jake-at-work jake-at-work reopened this Mar 23, 2018
Copy link
Member

@dgkimura dgkimura left a comment

Choose a reason for hiding this comment

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

Cool stuff. Just a couple comments to get an idea for where this is headed.

Random (and perhaps unrelated) thought - I see the value of integration tests as sort of a way to test all the pieces working together. But has there been any thought into how to refactor cppcache so that some of existing integration tests can be broken down and written as isolated unit tests?

#include <iostream>
#include <random>
#include <thread>
#include <future>
Copy link
Member

Choose a reason for hiding this comment

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

future. Sounds fancy. And looks like fun. ;)

target_link_libraries(_apache-geode INTERFACE
Dbghelp
)
target_compile_definitions(_apache-geode INTERFACE
# Required for Boost.WinAPI
_WIN32_WINNT=0x06020000
Copy link
Member

Choose a reason for hiding this comment

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

Whoa, what's going on here?!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some Boost dark magic! I couldn’t find any other good place to add it. It’s required to set the minimum NT version Boost.WinAPI will compile for. In this case NT 6.2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It popped up with the Boost 1.66

.region()
.withName("region")
.withType("REPLICATE")
.execute();
Copy link
Member

Choose a reason for hiding this comment

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

I like the fluent interface. But I wonder how is this going to scale out with different configurations?

After seeing past mistakes in this code base, I worry about different tests having slightly different configurations and seeing copy/paste commits that introduce obfuscated dependencies and bugs in the tests. Any thoughts for how we might be able to design this new test framework to help avoid/deter this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I see that concern. I was more concerned with avoiding our current framework tat hides away dozens of different configurations in base and helper classes. Here the preference is towards expressiveness. If you notice that command is nearly identical to the actual gfsh command you would type to create a region.

.withType("REPLICATE")
.execute();

auto task1 = std::async(std::launch::async, [&] {
Copy link
Member

Choose a reason for hiding this comment

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

Have you run into any limitations from switching to single process? Do you imagine that all dunit tests can be ported to this new framework?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No issues other than bugs in the client that it already flushed out. We claim to support multiple caches in the same process so this will make sure that holds true. The old framework had to create separate processes only because the cache was a global variable.

Yes all should be portable. As you can see I ported one and it took just a few minutes.

@jake-at-work
Copy link
Contributor Author

Yes. The goal is to migrate and refactor more code to unit tests. The other goal is to move away from the complicated existing integration framework and embrace a single process model now that we can have multiple caches per process.

@moleske
Copy link
Member

moleske commented Mar 26, 2018

I'm curious about spinning up a cluster for each test. When I've done other database type testing, I have usually just made sure to clear the database in a before each or after each to save start up slash shut down costs. Is there any concern here about that? I of course gladly take the win of easier debugging, single process, other things you already mentioned over my little concern.

@jake-at-work
Copy link
Contributor Author

@moleske I haven’t seen many developers successfully execute integration testing where a shared resource was modified. Too many times I have seen tests written dependent on the previous tests completing successfully. Those bad tests lead to inabilities to parallelize, reorder or run in isolation. I personally prefer to set an example of clean and isolated integration tests.

That all said this framework does not enforce any resource management on the tests or test cases.

@moleske
Copy link
Member

moleske commented Mar 26, 2018

Great points, there can be bad practices like that. Would love if we can randomize the order of the tests run each time to prevent that.

@jake-at-work
Copy link
Contributor Author

Because we run them using CTest and in parallel they are effectively randomized but can’t share resources since they are all launched in separate processes. Using the gtest runner they all run sequentially based on their defined order at compile time (no parallelism support).

@jake-at-work jake-at-work merged commit 09744d5 into apache:develop Mar 29, 2018
@jake-at-work jake-at-work deleted the feature/GEODE-4921 branch June 5, 2018 23:48
jake-at-work added a commit to jake-at-work/geode-native that referenced this pull request Oct 6, 2018
- Single process.
- Easy to debug from IDE.
- No environment variables required to run.
- Uses GTest as base framework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants