Skip to content

Commit 2414cfe

Browse files
author
mw0x7
committed
fix data race in bos_service and chat_service tests
Caused by issue described in stretchr/testify#1229. The workaround here is to close out the session in the same goroutine as handleNewConnection. This actually simplifies the code by reducing the # of goroutines per connection by 1 and allowing the unit tests to synchronize without a waitgroup.
1 parent f7c3dc3 commit 2414cfe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+243
-186
lines changed

.github/workflows/go.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will build a golang project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3+
4+
name: Go
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.21'
23+
24+
- name: Build
25+
run: go build -v ./...
26+
27+
- name: Test
28+
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
29+
30+
- name: Upload coverage reports to Codecov
31+
uses: codecov/codecov-action@v3

.mockery.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ dir: "{{.InterfaceDir}}"
33
mockname: "mock{{.InterfaceName}}"
44
inpackage: True
55
packages:
6-
github.com/mkaminski/goaim/server:
6+
github.com/mw0x7/retro-aim-server/server:
77
interfaces:
88
AuthHandler:
99
config:
@@ -44,7 +44,7 @@ packages:
4444
ChatServiceRouter:
4545
config:
4646
filename: "chat_service_router_mock_test.go"
47-
github.com/mkaminski/goaim/handler:
47+
github.com/mw0x7/retro-aim-server/handler:
4848
interfaces:
4949
FeedbagManager:
5050
config:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Mike Kaminski
3+
Copyright (c) 2024 mw0x7
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Retro AIM Server
2+
[![codecov](https://codecov.io/github/mw0x7/retro-aim-server/graph/badge.svg?token=MATKPP77JT)](https://codecov.io/github/mw0x7/retro-aim-server)
23

34
Retro AIM Server is a server implementation of the OSCAR protocol that supports AIM versions 5.0-5.9.
45

cmd/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import (
66
"os"
77
"sync"
88

9-
"github.com/mkaminski/goaim/handler"
10-
"github.com/mkaminski/goaim/state"
9+
"github.com/mw0x7/retro-aim-server/handler"
10+
"github.com/mw0x7/retro-aim-server/state"
1111

1212
"github.com/kelseyhightower/envconfig"
13-
"github.com/mkaminski/goaim/server"
13+
"github.com/mw0x7/retro-aim-server/server"
1414
)
1515

1616
func main() {

codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage:
2+
round: down
3+
range: 70..79

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
module github.com/mkaminski/goaim
1+
module github.com/mw0x7/retro-aim-server
22

3-
go 1.20
3+
go 1.21.3
44

55
require (
6-
github.com/google/uuid v1.3.0
6+
github.com/google/uuid v1.5.0
77
github.com/kelseyhightower/envconfig v1.4.0
8-
github.com/mattn/go-sqlite3 v1.14.17
8+
github.com/mattn/go-sqlite3 v1.14.19
99
github.com/stretchr/testify v1.8.4
1010
)
1111

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
5-
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
4+
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
5+
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
66
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
77
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
8-
github.com/mattn/go-sqlite3 v1.14.17 h1:mCRHCLDUBXgpKAqIKsaAaAsrAlbkeomtRFKXh2L6YIM=
9-
github.com/mattn/go-sqlite3 v1.14.17/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
8+
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
9+
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
1010
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
1111
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1212
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

handler/auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"errors"
77

88
"github.com/google/uuid"
9-
"github.com/mkaminski/goaim/oscar"
10-
"github.com/mkaminski/goaim/server"
11-
"github.com/mkaminski/goaim/state"
9+
"github.com/mw0x7/retro-aim-server/oscar"
10+
"github.com/mw0x7/retro-aim-server/server"
11+
"github.com/mw0x7/retro-aim-server/state"
1212
)
1313

1414
// NewAuthService creates a new instance of AuthService.

handler/auth_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"testing"
66

77
"github.com/google/uuid"
8-
"github.com/mkaminski/goaim/oscar"
9-
"github.com/mkaminski/goaim/server"
10-
"github.com/mkaminski/goaim/state"
8+
"github.com/mw0x7/retro-aim-server/oscar"
9+
"github.com/mw0x7/retro-aim-server/server"
10+
"github.com/mw0x7/retro-aim-server/state"
1111
"github.com/stretchr/testify/assert"
1212
"github.com/stretchr/testify/mock"
1313
)

0 commit comments

Comments
 (0)