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

Allow table/sst_file_reader_test.cc to use custom Env #6536

Closed

Conversation

akankshamahajan15
Copy link
Contributor

Allowing table/sst_file_reader_test.cc to use custom Env specified by TEST_ENV_URI.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@akankshamahajan15 has updated the pull request. Re-import the pull request

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Thanks @akankshamahajan15 for working on this!
Given that options_:Options has a member variable env, let's add a member env_ to the class. The env_ will be loaded in the constructor and assigned to options.env and used throughout the test.

@akankshamahajan15
Copy link
Contributor Author

Thanks @akankshamahajan15 for working on this!
Given that options_:Options has a member variable env, let's add a member env_ to the class. The env_ will be loaded in the constructor and assigned to options.env and used throughout the test.

Hi @riversand963 , I wanted to ask is Loading part using Env::LoadEnv inside getenv(WsEnviroment) correct. In DBTestBase, they have a seperate class foreg MockEnv or NewEncryptedEnv which set the objects based on getenv(type_of_enviroment). And then that is set to options.env

@riversand963
Copy link
Contributor

Thanks @akankshamahajan15 for working on this!
Given that options_:Options has a member variable env, let's add a member env_ to the class. The env_ will be loaded in the constructor and assigned to options.env and used throughout the test.

Hi @riversand963 , I wanted to ask is Loading part using Env::LoadEnv inside getenv(WsEnviroment) correct. In DBTestBase, they have a seperate class foreg MockEnv or NewEncryptedEnv which set the objects based on getenv(type_of_enviroment). And then that is set to options.env

We can disregard mock env and encryption env here.

@facebook-github-bot
Copy link
Contributor

@akankshamahajan15 has updated the pull request. Re-import the pull request

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

table/sst_file_reader_test.cc Outdated Show resolved Hide resolved
table/sst_file_reader_test.cc Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

@akankshamahajan15 has updated the pull request. Re-import the pull request

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

Good job. One last piece is adding something like (https://github.com/facebook/rocksdb/blob/master/db/db_basic_test.cc#L2204:L2210) before the main function of sst_file_reader_test.cc, and call the function accordingly, similar to https://github.com/facebook/rocksdb/blob/master/db/db_basic_test.cc#L2215.
Nit: call ROCKSDB_NAMESPACE::port::InstallStackTraceHandler(); at the beginning of main(), too.

@facebook-github-bot
Copy link
Contributor

@akankshamahajan15 has updated the pull request. Re-import the pull request

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

}

~SstFileReaderTest() {
Status s = Env::Default()->DeleteFile(sst_name_);
Status s = env_->DeleteFile(sst_name_);
assert(s.ok());
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: substitute assert(s.ok()) for EXPECT_OK(s).

Copy link
Contributor

@riversand963 riversand963 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @akankshamahajan15 for the PR.

@facebook-github-bot
Copy link
Contributor

@akankshamahajan15 has updated the pull request. Re-import the pull request

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@akankshamahajan15 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@akankshamahajan15 merged this pull request in a8149ae.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants