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

Failing tests of logging_test.go when randomizing execution order of tests #556

Closed
orpheuslummis opened this issue Jun 22, 2022 · 1 comment · Fixed by #552
Closed

Failing tests of logging_test.go when randomizing execution order of tests #556

orpheuslummis opened this issue Jun 22, 2022 · 1 comment · Fixed by #552
Assignees
Labels
area/logging Related to the logging/logger system area/testing Related to any test or testing suite bug Something isn't working
Milestone

Comments

@orpheuslummis
Copy link
Contributor

Depending on the root cause(s), this might be a single issue or multiple.
Related to #551
When randomizing the execution order of tests, the following tests of logging_test.go fail:

--- FAIL: TestLogWritesMessagesToLogGivenUpdatedLogPath (0.02s)
    logging_test.go:370: 
                Error Trace:    logging_test.go:370
                Error:          "[]" should have 1 item(s), but has 0
                Test:           TestLogWritesMessagesToLogGivenUpdatedLogPath
panic: runtime error: index out of range [0] with length 0 [recovered]
        panic: runtime error: index out of range [0] with length 0

goroutine 25 [running]:
testing.tRunner.func1.2({0x640540, 0xc000016108})
        /usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1212 +0x218
panic({0x640540, 0xc000016108})
        /usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/sourcenetwork/defradb/logging.TestLogWritesMessagesToLogGivenUpdatedLogPath(0xc0001a6820)
        /home/o/dev/defradb/logging/logging_test.go:371 +0x46c
testing.tRunner(0xc0001a6820, 0x66b6f8)
        /usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1306 +0x35a
--- FAIL: TestLogWritesMessagesToLog (0.00s)
    logging_test.go:246: 
                Error Trace:    logging_test.go:246
                Error:          "[]" should have 1 item(s), but has 0
                Test:           TestLogWritesMessagesToLog
panic: runtime error: index out of range [0] with length 0 [recovered]
        panic: runtime error: index out of range [0] with length 0

goroutine 7 [running]:
testing.tRunner.func1.2({0x640540, 0xc000016300})
        /usr/local/go/src/testing/testing.go:1209 +0x24e
testing.tRunner.func1()
        /usr/local/go/src/testing/testing.go:1212 +0x218
panic({0x640540, 0xc000016300})
        /usr/local/go/src/runtime/panic.go:1038 +0x215
github.com/sourcenetwork/defradb/logging.TestLogWritesMessagesToLog(0x0)
        /home/o/dev/defradb/logging/logging_test.go:247 +0x475
testing.tRunner(0xc00010b520, 0x66b700)
        /usr/local/go/src/testing/testing.go:1259 +0x102
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:1306 +0x35a
--- FAIL: TestLogDoesNotWriteMessagesToLogGivenOverrideForAnotherLoggerReducingLogLevel (0.01s)
    logging_test.go:394: 
                Error Trace:    logging_test.go:394
                Error:          "[map[level:WARN logger:TestLogName msg:test log message ts:2022-06-22T15:46:52.870Z]]" should have 0 item(s), but has 1
                Test:           TestLogDoesNotWriteMessagesToLogGivenOverrideForAnotherLoggerReducingLogLevel
@orpheuslummis
Copy link
Contributor Author

orpheuslummis commented Jun 23, 2022

To replicate:

make clean:test && go test -v -shuffle=on ./logging/

Increase -count=n if the first run improbably takes a sequence in which it passes

@fredcarle fredcarle self-assigned this Jun 23, 2022
fredcarle added a commit that referenced this issue Jun 27, 2022
…nd add output path validation (#552)

Relevant issue(s)
Resolves #551
Resolves #550
Resolves #556

Description
- This PR helps to solve the issue of too many open files on some systems due to loggers being added (without clearing the old ones) with every call to getLogger. 
- Changes were applied to the test functions to limit panics when something goes wrong.
- Added validation of log paths.
- Added log pipe for test that sent logs to stderr.
shahzadlone pushed a commit to shahzadlone/defradb that referenced this issue Feb 23, 2024
…nd add output path validation (sourcenetwork#552)

Relevant issue(s)
Resolves sourcenetwork#551
Resolves sourcenetwork#550
Resolves sourcenetwork#556

Description
- This PR helps to solve the issue of too many open files on some systems due to loggers being added (without clearing the old ones) with every call to getLogger. 
- Changes were applied to the test functions to limit panics when something goes wrong.
- Added validation of log paths.
- Added log pipe for test that sent logs to stderr.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logging Related to the logging/logger system area/testing Related to any test or testing suite bug Something isn't working
Projects
None yet
2 participants