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

Migrate temporalite & temporaltest packages #4026

Merged
merged 56 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
804337e
Add temporalite & temporaltest packages
jlegrone Mar 7, 2023
ceb5741
Move test workflow/interceptor into temoraltest package
jlegrone Mar 10, 2023
9062c19
Move liteconfig into temporalite package
jlegrone Mar 10, 2023
9a527fd
Remove ui server
jlegrone Mar 10, 2023
b8fee47
Remove unused timeoutFromContext func
jlegrone Mar 10, 2023
53d73e1
Avoid stuttering in temporalite package
jlegrone Mar 10, 2023
b5e7487
Always use dynamic ports
jlegrone Mar 10, 2023
3f2d1e5
Add additional config doc comments
jlegrone Mar 10, 2023
73dacd0
Update copyright
jlegrone Mar 17, 2023
2ca1af6
Refactor temporalite into temporal package
jlegrone Mar 21, 2023
1022888
Remove PublicClient config
jlegrone Mar 22, 2023
e650816
Revert "Remove PublicClient config"
jlegrone Mar 22, 2023
34760eb
Add license header
jlegrone Mar 22, 2023
9faaebc
Test setting BaseServerOptions
jlegrone Mar 22, 2023
c613ba8
Update godoc
jlegrone Mar 22, 2023
0cd959a
Move temporaltest to top level
jlegrone Mar 22, 2023
ecd00c4
Update temporaltest backwards compatability policy
jlegrone Mar 22, 2023
2e4bd13
Spellcheck
jlegrone Mar 22, 2023
40fd094
Update godoc
jlegrone Mar 28, 2023
73d31cc
Add temporaltest package to integration tests
jlegrone Mar 28, 2023
c512a54
Move LiteServer into internal package
jlegrone Apr 25, 2023
9ecf117
Merge branch 'master' into jlegrone/migrate-temporalite
jlegrone Apr 25, 2023
87a65ed
Add TODO to remove PublicClient config
jlegrone Apr 25, 2023
43810ea
Document that TestServer methods are unsafe for concurrent use
jlegrone Apr 25, 2023
6aa60b0
Don't return an error from denyAllClaimMapper
jlegrone Apr 25, 2023
2b717b0
Merge branch 'master' into jlegrone/migrate-temporalite
jlegrone Jun 15, 2023
b41ac72
Merge branch 'master' into jlegrone/migrate-temporalite
jlegrone Jul 26, 2023
3030a0c
Test registering and listing workflows using custom search attribute
jlegrone Jul 26, 2023
f8ff2a7
Use errors.As to check for permission denied
jlegrone Jul 26, 2023
04bf716
Verify that a custom worker option was set
jlegrone Jul 26, 2023
f9d60cf
Add TODO to investigate whether randomized db name is necessary in sh…
jlegrone Jul 26, 2023
5a39dec
Return error instead of panic while getting port
jlegrone Jul 26, 2023
ac773d3
Update freeport.go to be unique implementation
jlegrone Jul 26, 2023
ff3ebf3
Remove temporaltest from UNIT_TEST_DIRS
jlegrone Jul 26, 2023
8d29d27
Skip conditional check when appending opts
jlegrone Jul 26, 2023
cf56460
Remove godoc comment about overriding ConnectionOptions
jlegrone Jul 26, 2023
9a0e082
Use maps.Keys
jlegrone Jul 26, 2023
4d1d04b
Don't set MembershipPort twice
jlegrone Jul 26, 2023
4f4070c
Add log.Logger type assertion
jlegrone Jul 26, 2023
d240ccf
Simplify TestServerOption applyFunc
jlegrone Jul 26, 2023
4ecfb55
Delegate to NewWorkerWithOptions
jlegrone Jul 26, 2023
0da8117
Start server synchronously
jlegrone Jul 26, 2023
12bdf7a
Add internal/temporalite to integration tests
jlegrone Jul 26, 2023
f599ac3
Merge branch 'main' into jlegrone/migrate-temporalite
jlegrone Aug 8, 2023
d233bed
Flaky fixes
jlegrone Aug 8, 2023
364b2db
Remove deprecated rand.Seed call
jlegrone Aug 8, 2023
af4f963
WIP
jlegrone Aug 8, 2023
67032f0
Use Eventually to speed up TestSearchAttributeRegistration
jlegrone Aug 16, 2023
20ab82a
Merge branch 'main' into jlegrone/migrate-temporalite
jlegrone Aug 16, 2023
fe318f9
Merge branch 'main' into jlegrone/migrate-temporalite
yiminc Aug 25, 2023
60c302e
Merge branch 'main' into jlegrone/migrate-temporalite
jlegrone Sep 5, 2023
b5e2ef7
Merge branch 'main' into jlegrone/migrate-temporalite
yiminc Oct 13, 2023
211c9af
Fix lint warnings: add error handling on test server shutdown
jlegrone Oct 17, 2023
5d217dd
Inline useless else branch
jlegrone Oct 17, 2023
a936d52
Fix unit test filter
jlegrone Oct 17, 2023
79883a7
Remove parallelism from temporaltest tests to avoid tripping race det…
jlegrone Oct 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ FUNCTIONAL_TEST_XDC_ROOT := ./tests/xdc
FUNCTIONAL_TEST_NDC_ROOT := ./tests/ndc
DB_INTEGRATION_TEST_ROOT := ./common/persistence/tests
DB_TOOL_INTEGRATION_TEST_ROOT := ./tools/tests
INTEGRATION_TEST_DIRS := $(DB_INTEGRATION_TEST_ROOT) $(DB_TOOL_INTEGRATION_TEST_ROOT)
UNIT_TEST_DIRS := $(filter-out $(FUNCTIONAL_TEST_ROOT)% $(FUNCTIONAL_TEST_XDC_ROOT)% $(FUNCTIONAL_TEST_NDC_ROOT)% $(DB_INTEGRATION_TEST_ROOT)% $(DB_TOOL_INTEGRATION_TEST_ROOT)%,$(TEST_DIRS))
INTEGRATION_TEST_DIRS := $(DB_INTEGRATION_TEST_ROOT) $(DB_TOOL_INTEGRATION_TEST_ROOT) ./temporaltest ./internal/temporalite
UNIT_TEST_DIRS := $(filter-out $(FUNCTIONAL_TEST_ROOT)% $(FUNCTIONAL_TEST_XDC_ROOT)% $(FUNCTIONAL_TEST_NDC_ROOT)% $(INTEGRATION_TEST_DIRS)%,$(TEST_DIRS))
jlegrone marked this conversation as resolved.
Show resolved Hide resolved

# github.com/urfave/cli/[email protected] - needs to accept comma in values before unlocking https://github.com/urfave/cli/pull/1241.
PINNED_DEPENDENCIES := \
Expand Down
75 changes: 75 additions & 0 deletions internal/temporalite/freeport.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// The MIT License
//
// Copyright (c) 2021 Datadog, Inc.
//
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package temporalite

import (
"fmt"
"net"
)

func newPortProvider() *portProvider {
return &portProvider{}
}

type portProvider struct {
listeners []*net.TCPListener
}

// GetFreePort finds an open port on the system which is ready to use.
func (p *portProvider) GetFreePort() (int, error) {
addr, err := net.ResolveTCPAddr("tcp", "127.0.0.1:0")
if err != nil {
if addr, err = net.ResolveTCPAddr("tcp6", "[::1]:0"); err != nil {
return 0, fmt.Errorf("failed to get free port: %w", err)
}
}

l, err := net.ListenTCP("tcp", addr)
if err != nil {
return 0, err
}

p.listeners = append(p.listeners, l)

return l.Addr().(*net.TCPAddr).Port, nil
}

// MustGetFreePort calls GetFreePort, panicking on error.
func (p *portProvider) MustGetFreePort() int {
port, err := p.GetFreePort()
if err != nil {
panic(err)
}
return port
}

func (p *portProvider) Close() error {
for _, l := range p.listeners {
if err := l.Close(); err != nil {
return err
}
}
return nil
}
Loading
Loading