YugaByte DB Community Forum

Is this a new test bug?


#1

The test case “TestPathUtil.TestODirectFileCreationInDir” fail to pass when I run it with root access.

The error is:

138: TEST FAILURE
...
138: Relevant log lines:
138: [----------] 1 test from TestPathUtil
138: [ RUN      ] TestPathUtil.TestODirectFileCreationInDir
138: ../../../../../src/yb/util/path_util-test.cc:88: Failure
138: Value of: (CheckODirectTempFileCreationInDir(env_test, dir)).ok()
138:   Actual: true
138: Expected: false
138: Test failure stack trace:
138: ../../../../../src/yb/util/path_util-test.cc:88:

After I added ‘LOG(INFO) << fname.get()<< " fd:"<<fd;’ in function CheckODirectTempFileCreationInDir, I got these:

[----------] 1 test from TestPathUtil
[ RUN      ] TestPathUtil.TestODirectFileCreationInDir
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0419 23:32:18.368190  9414 path_util.cc:128] /var/run.tmp.JTD0gl fd:3  
../../../../../src/yb/util/path_util-test.cc:88: Failure
Value of: (CheckODirectTempFileCreationInDir(env_test, dir)).ok()
  Actual: true
Expected: false
Test failure stack trace:

The /var/run.tmp.JTD0gl was created successfully,
but I guess the fname should have been /var/run/.tmp.JTD0gl, because the relevant code is

string dir = "/var/run"; // in TEST(TestPathUtil, TestODirectFileCreationInDir) 
...
ASSERT_NOK(CheckODirectTempFileCreationInDir(env_test, dir)); //in same function as before
...
string name_template = dir_path + kTmpTemplateSuffix;// dir_path==dir, kTmpTemplateSuffix==.tmp.XXXXXX in CheckODirectTempFileCreationInDir
ThreadRestrictions::AssertIOAllowed(); //in same function as before
std::unique_ptr<char[]> fname(new char[name_template.size() + 1]); //in same function as before
::snprintf(fname.get(), name_template.size() + 1, "%s", name_template.c_str()); //in same function as before

I seems that “dir_path + kTmpTemplateSuffix” should be “dir_path + “/”+kTmpTemplateSuffix” because you call “/var/run” a dir not a file prefix.

Plus: Sorry for my poor english(哈哈)


#2

Adding a few folks who can help. cc @mbautin, @bogdan, @Timur


#3

@lumedar, can you specify which OS are you using to run the tests and what are the command lines?


#4

On my docker container
[root@69d63e0ff4fe etc]# cat system-release
CentOS Linux release 7.4.1708 (Core)

138: Test command: /builds/database/yugabyte-db/build/debug-gcc-dynamic-community/tests-util/path_util-test --gtest_output=xml:/builds/database/yugabyte-db/build/debug-gcc-dynamic-community/yb-test-logs/tests-util__path_util-test/TestPathUtil_TestODirectFileCreationInDir.xml --gtest_filter=TestPathUtil.TestODirectFileCreationInDir


#5

Does this test case need non-root access to run? Because when I run it with non-root access, it passes.


#6

@lumedar, thanks for pointing out a bug in this test case - it should work under root account as well. I’ve created a GitHub issue https://github.com/YugaByte/yugabyte-db/issues/236 and fix will be ready soon.


#7

@lumedar, the fix has been committed into master branch: https://github.com/YugaByte/yugabyte-db/commit/bb204e4411beffda750a1512fda61cdaccf789ea


#8

Hi @lumedar,

I am marking @Timur’s comment as the solution, please feel free to comment if that did not solve the issue for you. Thanks!


#9

Thanks. It has solved the issue.:grin: