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

Add integration tests progress reporting #3471

Conversation

rubiagatra
Copy link
Contributor

@rubiagatra rubiagatra commented Sep 30, 2023

Description

Closes #3055 . Still WIP

Readiness checklist (Still in discussion)

  • I added/updated unit tests (and they pass).
  • I added/updated integration/compatibility tests (and they pass).
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Milestone (Next), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@rubiagatra rubiagatra requested a review from a team as a code owner September 30, 2023 12:33
@CLAassistant
Copy link

CLAassistant commented Sep 30, 2023

CLA assistant check
All committers have signed the CLA.

@rubiagatra rubiagatra marked this pull request as draft September 30, 2023 12:33
@AlekSi
Copy link
Member

AlekSi commented Sep 30, 2023

@rubiagatra please leave a comment at #3055 so it can be assigned to you

@rubiagatra rubiagatra force-pushed the test/3055-integration-tests-should-report-their-progress branch from fae6ad6 to 5d66c52 Compare September 30, 2023 12:41
@rubiagatra
Copy link
Contributor Author

done @AlekSi! already commented

@AlekSi AlekSi removed request for AlekSi and chilagrow October 4, 2023 05:06
@AlekSi AlekSi added the code/chore Code maintenance improvements label Oct 4, 2023
@AlekSi AlekSi added this to the Next milestone Oct 4, 2023
Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

Please un-draft it and re-request review once it is ready

@rubiagatra rubiagatra force-pushed the test/3055-integration-tests-should-report-their-progress branch from 5d66c52 to 241cafd Compare October 7, 2023 09:28
@rubiagatra rubiagatra changed the title draft: start to investigate report of integration test test: start to investigate report of integration test Oct 7, 2023
@rubiagatra rubiagatra requested a review from AlekSi October 7, 2023 09:29
@rubiagatra rubiagatra marked this pull request as ready for review October 7, 2023 09:30
@rubiagatra
Copy link
Contributor Author

rubiagatra commented Oct 7, 2023

Hey @AlekSi this is my first iteration sorry for still WIP. Could you check is this going in the right way?

The output of the integration should be like this

➜ task test-integration
task: [test-integration-pg] ../bin/envtool tests run --shard-index=1 --shard-total=1 --run='' -- -count=1 -timeout=35m -race=true -tags=ferretdb_debug,ferretdb_hana -shuffle=on -coverpkg=../... -coverprofile=integration-pg.txt . -target-backend=ferretdb-pg -target-tls -postgresql-url='postgres://username@127.0.0.1:5432/ferretdb?pool_max_conns=50&search_path=' -compat-url='mongodb://username:password@127.0.0.1:47018/?tls=true&tlsCertificateKeyFile=../build/certs/client.pem&tlsCaFile=../build/certs/rootCA-cert.pem' -disable-filter-pushdown=false -enable-sort-pushdown=false

Pass: github.com/FerretDB/FerretDB/integration/TestCommandsAdministrationServerStatusStress
Pass: github.com/FerretDB/FerretDB/integration/TestFindCommentMethod
Fail: github.com/FerretDB/FerretDB/integration/TestCreateOnInsertStressDiffCollection
Pass: github.com/FerretDB/FerretDB/integration/TestFindAndModifyCompatDotNotation/Conflict/TestFindAndModifyCompatDotNotation-Conflict_Scalars
Pass: github.com/FerretDB/FerretDB/integration/TestFindAndModifyCompatDotNotation/Conflict/TestFindAndModifyCompatDotNotation-Conflict_Int32s

I know it is not really ready to review but I need your guidance

Thank you!

@rubiagatra rubiagatra force-pushed the test/3055-integration-tests-should-report-their-progress branch from 241cafd to 668e1bc Compare October 7, 2023 09:34
@AlekSi AlekSi modified the milestones: v1.12.0, Next Oct 9, 2023
@AlekSi AlekSi self-assigned this Oct 10, 2023
Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

I think the output should be something like that:

Pass: TestCommandsAdministrationServerStatusStress 1/1500
Pass: TestFindCommentMethod 2/1500
…

We could cut github.com/FerretDB/FerretDB/integration prefix and add current/total output.

cmd/envtool/envtool.go Outdated Show resolved Hide resolved
cmd/envtool/envtool.go Outdated Show resolved Hide resolved
@rubiagatra rubiagatra force-pushed the test/3055-integration-tests-should-report-their-progress branch from 668e1bc to ff897de Compare October 11, 2023 12:28
@rubiagatra
Copy link
Contributor Author

got it @AlekSi, let me update for it. I'll let you know if it ready

@rubiagatra rubiagatra force-pushed the test/3055-integration-tests-should-report-their-progress branch 3 times, most recently from 458dbb0 to 22d28f7 Compare October 11, 2023 13:33
@rubiagatra
Copy link
Contributor Author

rubiagatra commented Oct 11, 2023

Hi, @AlekSi I just updated the code It look like this

Pass: TestGetMoreCommandMaxTimeMSCursor/FindExpire 1/247
Pass: TestGetMoreCommandMaxTimeMSCursor/FindGetMoreMaxTimeMS 2/247
Pass: TestGetMoreCommandMaxTimeMSCursor/AggregateExpire 3/247

I know the total tests are not 247 because of nested tests. How we approach these problem? I only can get the root of the test

maybe want to sum all test inside integration test?

func countTestsInFile(filename string) int {
	content, err := ioutil.ReadFile(filename)
	if err != nil {
		return 0
	}

	re := regexp.MustCompile(`func Test\w+\(t \*testing\.T\)`)
	matches := re.FindAll(content, -1)
	return len(matches)
}

Taskfile.yml Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
cmd/envtool/tests.go Outdated Show resolved Hide resolved
@mergify mergify bot removed the conflict PRs that have merge conflicts label Oct 20, 2023
@rubiagatra rubiagatra requested a review from AlekSi October 20, 2023 12:50
@rubiagatra
Copy link
Contributor Author

HI @AlekSi, Let me know if something is not right in my implementation at the error / skip test. I resolved all requested changes. Thank you!

@AlekSi AlekSi modified the milestones: v1.13.0, Next Oct 23, 2023
@AlekSi
Copy link
Member

AlekSi commented Oct 24, 2023

@rubiagatra I updated tests. I think we should include the output of the parent(s) test if subtest fail, so we could read the whole log in one place. On the other hand, if subtest fails, there is no need to show parent test output, I think.

And we should add a test where the parent test fails.

Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

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

@rubiagatra
Copy link
Contributor Author

Got it @AlekSi will let you know if its done

@rubiagatra
Copy link
Contributor Author

HI @AlekSi Sorry for the late update. I a little bit struggle with this from:

                                FAIL TestError1 (1/2)
                                  === RUN   TestError1
                                  error_test.go:20: not hidden 1
                                  error_test.go:22: Error 1
                                  error_test.go:24: not hidden 2
                                  --- FAIL: TestError1 (0.00s)
                                PASS TestError2/NotParallel
                                FAIL TestError2/Parallel
                                  === RUN   TestError2/Parallel
                                  error_test.go:35: not hidden 5
                                  === PAUSE TestError2/Parallel
                                  === CONT  TestError2/Parallel
                                  error_test.go:39: not hidden 6
                                  error_test.go:41: Error 2
                                  error_test.go:43: not hidden 7
                                  --- FAIL: TestError2/Parallel (0.00s)
                                FAIL TestError2 (2/2)
                                  === RUN   TestError2
                                  error_test.go:28: not hidden 3
                                  === PAUSE TestError2
                                  === CONT  TestError2
                                  error_test.go:32: not hidden 4
                                  --- FAIL: TestError2 (0.00s)
                      "FAIL TestError1 (1/2)",
                      "  === RUN   TestError1",
                      "  error_test.go:20: not hidden 1",
                      "  error_test.go:22: Error 1",
                      "  error_test.go:24: not hidden 2",
                      "  --- FAIL: TestError1 (0.00s)",
                      "PASS TestError2/NotParallel",
                      "FAIL TestError2/Parallel",
                      "  === RUN   TestError2/Parallel",
                      "  error_test.go:28: not hidden 3",
                      "  === PAUSE TestError2",
                      "  === CONT  TestError2",
                      "  error_test.go:32: not hidden 4",
                      "  error_test.go:35: not hidden 5",
                      "  === PAUSE TestError2/Parallel",
                      "  === CONT  TestError2/Parallel",
                      "  error_test.go:39: not hidden 6",
                      "  error_test.go:41: Error 2",
                      "  error_test.go:43: not hidden 7",
                      "  --- FAIL: TestError2/Parallel (0.00s)",
                      "FAIL TestError2 (2/2)",

Can you give me an idea of how we do this?

Should we collect all the logs first, check which child failed, and log them all in the correct order based on your suggestion? We cannot print directly, as we do now.

Thank you!

@AlekSi AlekSi merged commit 09ec58c into FerretDB:main Oct 30, 2023
25 of 26 checks passed
@AlekSi
Copy link
Member

AlekSi commented Oct 30, 2023

@rubiagatra I played a bit with the expected output to make it good enough with a simple implementation – and I think it is good enough now :) Thank you!

@rubiagatra
Copy link
Contributor Author

I want to say thank you for your support @AlekSi, I hope I can contribute more in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Integration tests should report their progress
3 participants