This is the GitHub action file that I have used in the workflows.
.github/workflows/go.yml
name: Go
on:
push:
branches: [ master development ]
tags:
- '*'
pull_request:
branches:
- '*'
jobs:
test:
name: Test
runs-on: [self-hosted, linux]
services:
solr:
image: solr
ports:
- 2010:8983
options: solr:8.3.1 - cloud
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Test
run: |
mkdir build
go test ./... -v -coverprofile build/coverage.txt -coverpkg=./...
cat build/coverage.txt | grep -v '.pb.go' > build/coverage.out
go tool cover -func build/coverage.out
- uses: actions/upload-artifact@v2
with:
name: build artifacts
path: build
In the result of the workflow I am getting connection refused
, Workflow is able to pull the Solr container but, in my test, I am getting the following error:
Get "http://localhost:2010/solr/customer/select?q=id%3A2+\u0026wt=json": dial tcp 127.0.0.1:2010: connect: connection refused"
Since the Solr container has been pulled, I am expecting my test to successfully hit the Solr API.
I believe your "options" setting is actually passing args to the container that make the service error out. At least, when I try them locally that's what seems to be happening. Try your service setup this way to get the explicit version you want:
It can be a bit difficult to debug service container startup. But if you dig around in the action logs you should find some clues.