登录
首页 >  Golang >  Go问答

在 Github 工作流程中初始化 Solr 遇到问题

来源:stackoverflow

时间:2024-03-05 10:45:26 243浏览 收藏

哈喽!今天心血来潮给大家带来了《在 Github 工作流程中初始化 Solr 遇到问题》,想必大家应该对Golang都不陌生吧,那么阅读本文就都不会很困难,以下内容主要涉及到,若是你正在学习Golang,千万别错过这篇文章~希望能帮助到你!

问题内容

这是我在工作流程中使用的 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 returned ,工作流程能够拉取 solr 容器,但在我的测试中,我收到以下错误:

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

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


解决方案


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

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

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

终于介绍完啦!小伙伴们,这篇关于《在 Github 工作流程中初始化 Solr 遇到问题》的介绍应该让你收获多多了吧!欢迎大家收藏或分享给更多需要学习的朋友吧~golang学习网公众号也会发布Golang相关知识,快来关注吧!

声明:本文转载于:stackoverflow 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>