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

The race conditions in tests #7846

Closed
2403905 opened this issue Nov 29, 2023 · 0 comments · Fixed by #7847
Closed

The race conditions in tests #7846

2403905 opened this issue Nov 29, 2023 · 0 comments · Fixed by #7847
Assignees
Labels

Comments

@2403905
Copy link
Contributor

2403905 commented Nov 29, 2023

Describe the bug

The race conditions in tests

Steps to reproduce

  1. go test -race -v ./services/search/...
    The output:
Will run 31 of 31 specs
==================
WARNING: DATA RACE
Write at 0x00c000175c20 by goroutine 35:
  runtime.mapassign_faststr()
      /usr/local/go/src/runtime/map_faststr.go:203 +0x0
  github.com/owncloud/ocis/v2/services/search/pkg/search_test.glob..func1.1.1()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/debouncer_test.go:29 +0xb2
  github.com/owncloud/ocis/v2/services/search/pkg/search.(*SpaceDebouncer).Debounce.func1()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/debouncer.go:51 +0x1a9

Previous read at 0x00c000175c20 by goroutine 32:
  runtime.mapaccess1_faststr()
      /usr/local/go/src/runtime/map_faststr.go:13 +0x0
  github.com/owncloud/ocis/v2/services/search/pkg/search_test.glob..func1.2.1()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/debouncer_test.go:38 +0x4e
  runtime.call16()
      /usr/local/go/src/runtime/asm_amd64.s:747 +0x42
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:380 +0xb5
  github.com/onsi/gomega/internal.(*AsyncAssertion).buildActualPoller.func3()
      /Users/roman/go/pkg/mod/github.com/onsi/gomega@v1.29.0/internal/async_assertion.go:325 +0x1cf
  github.com/onsi/gomega/internal.(*AsyncAssertion).match()
      /Users/roman/go/pkg/mod/github.com/onsi/gomega@v1.29.0/internal/async_assertion.go:540 +0xdcb
  github.com/onsi/gomega/internal.(*AsyncAssertion).Should()
      /Users/roman/go/pkg/mod/github.com/onsi/gomega@v1.29.0/internal/async_assertion.go:145 +0xc7
  github.com/owncloud/ocis/v2/services/search/pkg/search_test.glob..func1.2()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/debouncer_test.go:39 +0x1dc
  github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3()
      /Users/roman/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.13.0/internal/node.go:463 +0x2e
  github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3()
      /Users/roman/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.13.0/internal/suite.go:889 +0x105
•==================
WARNING: DATA RACE
Write at 0x00c000015b38 by goroutine 173:
  github.com/owncloud/ocis/v2/services/search/pkg/search_test.glob..func2.1()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/events_test.go:35 +0x44
  github.com/stretchr/testify/mock.(*Mock).MethodCalled()
      /Users/roman/go/pkg/mod/github.com/stretchr/testify@v1.8.4/mock/mock.go:552 +0x119a
  github.com/stretchr/testify/mock.(*Mock).Called()
      /Users/roman/go/pkg/mod/github.com/stretchr/testify@v1.8.4/mock/mock.go:464 +0x192
  github.com/owncloud/ocis/v2/services/search/pkg/search/mocks.(*Searcher).RestoreItem()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/mocks/searcher.go:42 +0xd5
  github.com/owncloud/ocis/v2/services/search/pkg/search.HandleEvents.func4.1()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/events.go:93 +0x6b7

Previous read at 0x00c000015b38 by goroutine 167:
  github.com/owncloud/ocis/v2/services/search/pkg/search_test.glob..func2.2()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/events_test.go:43 +0x2e
  runtime.call16()
      /usr/local/go/src/runtime/asm_amd64.s:747 +0x42
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:380 +0xb5
  github.com/onsi/gomega/internal.(*AsyncAssertion).buildActualPoller.func3()
      /Users/roman/go/pkg/mod/github.com/onsi/gomega@v1.29.0/internal/async_assertion.go:325 +0x1cf
  github.com/onsi/gomega/internal.(*AsyncAssertion).match()
      /Users/roman/go/pkg/mod/github.com/onsi/gomega@v1.29.0/internal/async_assertion.go:398 +0x2a7
  github.com/onsi/gomega/internal.(*AsyncAssertion).Should()
      /Users/roman/go/pkg/mod/github.com/onsi/gomega@v1.29.0/internal/async_assertion.go:145 +0xc7
  github.com/owncloud/ocis/v2/services/search/pkg/search_test.glob..func2()
      /Users/roman/projects/github.com/owncloud/ocis/services/search/pkg/search/events_test.go:44 +0x621
  runtime.call64()
      /usr/local/go/src/runtime/asm_amd64.s:749 +0x42
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:380 +0xb5
  github.com/onsi/ginkgo/v2.invokeFunction()
      /Users/roman/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.13.0/table_dsl.go:262 +0x428
  github.com/onsi/ginkgo/v2.generateTable.func2.2()
      /Users/roman/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.13.0/table_dsl.go:231 +0x87
  github.com/onsi/ginkgo/v2/internal.extractBodyFunction.func3()
      /Users/roman/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.13.0/internal/node.go:463 +0x2e
  github.com/onsi/ginkgo/v2/internal.(*Suite).runNode.func3()
      /Users/roman/go/pkg/mod/github.com/onsi/ginkgo/v2@v2.13.0/internal/suite.go:889 +0x105

Expected behavior

A clear and concise description of what you expected to happen.

Actual behavior

The race conditions in two tests

Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

OCIS_XXX=somevalue
OCIS_YYY=somevalue
PROXY_XXX=somevalue

Additional context

Add any other context about the problem here.

@2403905 2403905 self-assigned this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant