Skip to content

Commit

Permalink
Share Integration Tests Between Server Implementations
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Tucker <[email protected]>
  • Loading branch information
dave-tucker committed Oct 11, 2021
1 parent c59dafc commit 368593b
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 556 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ build: prebuild
test: prebuild
@echo "+ $@"
@go test -race -coverprofile=unit.cov -test.short -timeout 30s -v ./...
@IN_MEMORY_DATABASE=1 go test -race -coverprofile=ims-integration.cov -coverpkg=github.com/ovn-org/libovsdb/... -timeout 60s -v ./test/ovs

.PHONY: integration-test
integration-test:
Expand All @@ -31,7 +32,8 @@ integration-test:
.PHONY: coverage
coverage: test integration-test
@sed -i '1d' integration.cov
@cat unit.cov integration.cov > profile.cov
@sed -i '1d' ims-integration.cov
@cat unit.cov integration.cov ims-integration.cov > profile.cov

.PHONY: bench
bench: install-deps
Expand Down
3 changes: 0 additions & 3 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
type OvsdbServer struct {
srv *rpc2.Server
listener net.Listener
done chan struct{}
db Database
ready bool
readyMutex sync.RWMutex
Expand All @@ -36,7 +35,6 @@ type DatabaseModel struct {
// NewOvsdbServer returns a new OvsdbServer
func NewOvsdbServer(db Database, models ...DatabaseModel) (*OvsdbServer, error) {
o := &OvsdbServer{
done: make(chan struct{}, 1),
db: db,
models: make(map[string]DatabaseModel),
modelsMutex: sync.RWMutex{},
Expand Down Expand Up @@ -98,7 +96,6 @@ func (o *OvsdbServer) Close() {
o.ready = false
o.readyMutex.Unlock()
o.listener.Close()
close(o.done)
}

// Ready returns true if a server is ready to handle connections
Expand Down
Loading

0 comments on commit 368593b

Please sign in to comment.