无法在Github工作流程中初始化Solr

问题描述 投票:0回答:2

这是我在工作流程中使用的 GitHub 操作文件。

.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

在我得到的工作流程结果中

connection refused
,工作流程能够拉取 Solr 容器,但在我的测试中,我收到以下错误:

获取“http://localhost:2010/solr/customer/select?q=id%3A2+\u0026wt=json”:拨打 tcp 127.0.0.1:2010: connect: 连接被拒绝”

由于 Solr 容器已被拉出,我希望我的测试能够成功访问 Solr API。

git go github solr workflowservice
2个回答
0
投票

我相信您的“选项”设置实际上是将参数传递给容器,从而使服务出错。至少,当我在本地尝试它们时,似乎正在发生这种情况。尝试以这种方式设置您的服务以获得您想要的显式版本:

  services:
    solr:
      image: solr:8.3.1
      ports:
        - 2010:8983

调试服务容器启动可能有点困难。但如果您仔细研究操作日志,您应该会发现一些线索。


© www.soinside.com 2019 - 2024. All rights reserved.