작성
·
601
·
수정됨
0
안녕하세요,
CI - 배포 준비를 위한 Github Workflow 생성하기
강의 내용 중 위와 같이 run test 에서 오류 발생합니다.
test.yml은
name: test
on: pull_request
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Node.js setup
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install npm packages
run: npm ci
- name: Install and run redis-server
run: |
sudo apt-get update
sudo apt-get install -y redis-server
redis-server --daemonize yes --requirepass test_env --port 6380
- name: Run test
run: npm run test:ci
- name: Test build
run: npm run build
package.json은
"scripts": {
"build": "npx tsc",
"start": "node build/index.js",
"dev": "concurrently \"npx tsc --watch\" \"nodemon build/index.js\" ",
"test": "jest --watchAll --detectOpenHandles",
"test:ci": "jest"
},
index.test.ts는
import request from "supertest";
import { LIST_KEY, RedisClient, createApp } from "./app";
import * as redis from "redis";
let app: Express.Application;
let client: RedisClient;
const REDIS_URL = "redis://default:test_env@localhost:6380";
beforeAll(async () => {
client = redis.createClient({ url: REDIS_URL });
await client.connect();
app = createApp(client);
});
beforeEach(async () => {
await client.flushDb();
});
afterAll(async () => {
await client.flushDb();
await client.quit();
});
23.12.11 추가
redis 설치 시
Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B]
Hit:2 http://azure.archive.ubuntu.com/ubuntu jammy InRelease
Get:3 http://azure.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:6 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease [3631 B]
Get:7 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1244 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu jammy-updates/main Translation-en [257 kB]
Get:9 http://azure.archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [1226 kB]
Get:10 http://azure.archive.ubuntu.com/ubuntu jammy-updates/restricted Translation-en [199 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1018 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [226 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [27.8 kB]
Hit:14 https://ppa.launchpadcontent.net/ubuntu-toolchain-r/test/ubuntu jammy InRelease
Get:15 http://azure.archive.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1016 kB]
Get:16 http://azure.archive.ubuntu.com/ubuntu jammy-security/main Translation-en [195 kB]
Get:17 http://azure.archive.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [1179 kB]
Get:18 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [815 kB]
Get:19 http://azure.archive.ubuntu.com/ubuntu jammy-security/universe Translation-en [152 kB]
Get:20 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main arm64 Packages [28.7 kB]
Get:21 https://packages.microsoft.com/ubuntu/22.04/prod jammy/main amd64 Packages [117 kB]
Fetched 8042 kB in 2s (4798 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
libjemalloc2 liblua5.1-0 liblzf1 lua-bitop lua-cjson redis-tools
Suggested packages:
ruby-redis
The following NEW packages will be installed:
libjemalloc2 liblua5.1-0 liblzf1 lua-bitop lua-cjson redis-server
redis-tools
0 upgraded, 7 newly installed, 0 to remove and 37 not upgraded.
Need to get 1273 kB of archives.
After this operation, 5725 kB of additional disk space will be used.
Get:1 file:/etc/apt/apt-mirrors.txt Mirrorlist [142 B]
Get:2 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libjemalloc2 amd64 5.2.1-4ubuntu1 [240 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 liblua5.1-0 amd64 5.1.5-8.1build4 [99.9 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 liblzf1 amd64 3.6-3 [7444 B]
Get:5 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 lua-bitop amd64 1.0.2-5 [6680 B]
Get:6 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 lua-cjson amd64 2.1.0+dfsg-2.1 [17.4 kB]
Get:7 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 redis-tools amd64 5:6.0.16-1ubuntu1 [856 kB]
Get:8 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 redis-server amd64 5:6.0.16-1ubuntu1 [45.9 kB]
Fetched 1273 kB in 0s (2631 kB/s)
Selecting previously unselected package libjemalloc2:amd64.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 302654 files and directories currently installed.)
Preparing to unpack .../0-libjemalloc2_5.2.1-4ubuntu1_amd64.deb ...
Unpacking libjemalloc2:amd64 (5.2.1-4ubuntu1) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../1-liblua5.1-0_5.1.5-8.1build4_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1build4) ...
Selecting previously unselected package liblzf1:amd64.
Preparing to unpack .../2-liblzf1_3.6-3_amd64.deb ...
Unpacking liblzf1:amd64 (3.6-3) ...
Selecting previously unselected package lua-bitop:amd64.
Preparing to unpack .../3-lua-bitop_1.0.2-5_amd64.deb ...
Unpacking lua-bitop:amd64 (1.0.2-5) ...
Selecting previously unselected package lua-cjson:amd64.
Preparing to unpack .../4-lua-cjson_2.1.0+dfsg-2.1_amd64.deb ...
Unpacking lua-cjson:amd64 (2.1.0+dfsg-2.1) ...
Selecting previously unselected package redis-tools.
Preparing to unpack .../5-redis-tools_5%3a6.0.16-1ubuntu1_amd64.deb ...
Unpacking redis-tools (5:6.0.16-1ubuntu1) ...
Selecting previously unselected package redis-server.
Preparing to unpack .../6-redis-server_5%3a6.0.16-1ubuntu1_amd64.deb ...
Unpacking redis-server (5:6.0.16-1ubuntu1) ...
Setting up libjemalloc2:amd64 (5.2.1-4ubuntu1) ...
Setting up lua-cjson:amd64 (2.1.0+dfsg-2.1) ...
Setting up liblzf1:amd64 (3.6-3) ...
Setting up lua-bitop:amd64 (1.0.2-5) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1build4) ...
Setting up redis-tools (5:6.0.16-1ubuntu1) ...
Setting up redis-server (5:6.0.16-1ubuntu1) ...
Created symlink /etc/systemd/system/redis.service → /lib/systemd/system/redis-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/redis-server.service → /lib/systemd/system/redis-server.service.
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
NEEDRESTART-VER: 3.5
NEEDRESTART-KCUR: 6.2.0-1018-azure
NEEDRESTART-KEXP: 6.2.0-1018-azure
NEEDRESTART-KSTA: 1
Could not connect to Redis at 127.0.0.1:6380: Connection refused
Error: Process completed with exit code 1.
답변 3
0
흠..! 디버깅이 좀 필요해보이는데요. redis-cli -h 127.0.0.1 -p 6380 ping
이 코드를 install and run redis-server
마지막 그리고 Run test
시작 부분의 run에 추가해보실 수 있나요?
redis-server가 잘 돌아가고 있다면 각각 Pong
을 출력해줘야 합니다.
Could not connect to Redis at 127.0.0.1:6380: Connection refused
커넥션 실패합니다. 레디스 설치 로그 본문하단에 추가했습니다.
레디스 설치에 문제가 없는 거 같은데 실패하네요...
흠 github action 환경 관련 문제로 보이네요. 계속 디버깅을 해볼 수는 있겠으나 개인적으로 그냥 넘어가는걸 추천합니다. Docker 전에 배우는 부분들은 기본기를 익히고 무엇보다 기존 방식의 어려움을 체감하는 목적이 크거든요. 강의 끝 부분에 Docker, ECS를 활용한 모던한 배포방법을 다루게 됩니다!
0
0
안녕하세요, 동일하게 에러 발생합니다..