memsql / deployment-docker

This repository contains our official deployment Docker images for various products.
MIT License
15 stars 8 forks source link

Can't connect to port in GitHub action. #12

Open DedicatedDev opened 1 year ago

DedicatedDev commented 1 year ago

I'm getting this error. Error: Expected nil, but got: &net.OpErrorOp:"dial", Net:"tcp", Source:net.Addr(nil), Addr:(net.TCPAddr)(0xc000496a50), Err:(os.SyscallError)(0xc00047a6c0) 75 Test: TestAddProduct

In local machine, I have no trouble for this. this is config file. This error happens on Test step. I'm not sure why db client can't link to container db.

 name: Go

on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

jobs:
  build:
    runs-on: ubuntu-latest
    services:
      singlestore:
        image: memsql/cluster-in-a-box
        ports:
          - 3306:3306
          - 8080:8080
        volumes:
          # persist data between runs:
          - db-data:/var/lib/memsql
          - /home/user/init.sql:/init.sql
        env:
          # use the LICENSE_KEY environment variable set in the terminal:
          LICENSE_KEY: ${SINGLESTORE_LICENSE}
          ROOT_PASSWORD: helloworld
          START_AFTER_INIT: Y
    steps:
      - uses: actions/checkout@v3
      - name: Create env
        run: |
          mkdir config && echo "${{ secrets.ENV_FILE }}" > config/config.env && echo "${{ secrets.FIREBASE_ADMIN }}" > config/ownify-wallet-service-account.json
      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version: 1.19
      - name: Test
        run: go test -v ./...
DedicatedDev commented 1 year ago

I guess Golang sql client is failing to connect database