Skip to content

Commit

Permalink
Merge pull request #68 from meysamhadeli/fix-test
Browse files Browse the repository at this point in the history
chore: try for fix test
  • Loading branch information
xbucks authored Feb 28, 2023
2 parents e920b2c + 726951c commit ca6efd8
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
46 changes: 35 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,47 @@ on:
push:
branches: [ "main" , "develop"]
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "README.md"
- "CHANGELOG.md"
pull_request:
branches: [ "main" , "develop" ]
branches: [ "main" , "develop" ]

jobs:

build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: product_service test
working-directory: ./internal/services/product_service
run: go test -count=1 -v ./...
- name: pkg build
working-directory: ./internal/pkg
run: go build -v ./...

- name: identity_service build
working-directory: ./internal/services/identity_service
run: go build -v ./...

- name: product_service build
working-directory: ./internal/services/product_service
run: go build -v ./...

- name: inventory_service build
working-directory: ./internal/services/inventory_service
run: go build -v ./...

- name: product_service test
working-directory: ./internal/services/product_service
run: go test -count=1 -p=1 -v ./...

- name: identity_service test
working-directory: ./internal/services/identity_service
run: go test -count=1 -p=1 -v ./...

- name: inventory_service test
working-directory: ./internal/services/inventory_service
run: go test -count=1 -p=1 -v ./...
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/docker/go-connections/nat"
"github.com/meysamhadeli/shop-golang-microservices/internal/pkg/rabbitmq"
"github.com/meysamhadeli/shop-golang-microservices/internal/pkg/test/container/contracts"
log "github.com/sirupsen/logrus"
"github.com/streadway/amqp"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
Expand Down Expand Up @@ -55,6 +56,7 @@ func Start(ctx context.Context) (*amqp.Connection, *RabbitmqContainer, error) {
return nil, nil, fmt.Errorf("failed to get exposed container port: %v", err)
}

log.Info(realPort)
containerPort := realPort.Int()

var rabbitmqConfig = &rabbitmq.RabbitMQConfig{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ func TestRunner(t *testing.T) {

testFixture := &createProductEndToEndTests{endToEndTestFixture}
testFixture.Test_Should_Return_Ok_Status_When_Create_New_Product_To_DB()

defer func() {
testFixture.PostgresContainer.Terminate(testFixture.Ctx)
testFixture.RabbitmqContainer.Terminate(testFixture.Ctx)
}()

})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func TestRunner(t *testing.T) {

testFixture := &createProductIntegrationTests{integrationTestFixture}
testFixture.Test_Should_Create_New_Product_To_DB()

defer func() {
testFixture.PostgresContainer.Terminate(testFixture.Ctx)
testFixture.RabbitmqContainer.Terminate(testFixture.Ctx)
}()
})
}

Expand Down

0 comments on commit ca6efd8

Please sign in to comment.