Avoid CI Docker subnet exhaustion for the dependency stack.
Reuse the host bridge network in a CI compose override, prune unused networks, and isolate the job under COMPOSE_PROJECT_NAME=vigilcare-ci.
This commit is contained in:
+10
-2
@@ -15,6 +15,11 @@ on:
|
||||
jobs:
|
||||
backend:
|
||||
runs-on: ubuntu-latest
|
||||
# Isolated compose project + CI override (docker-compose.ci.yml) so jobs do
|
||||
# not steal Docker address-pool subnets from each other / from prod.
|
||||
env:
|
||||
COMPOSE_PROJECT_NAME: vigilcare-ci
|
||||
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
|
||||
# act_runner's docker executor runs steps inside their own job container — a
|
||||
# sibling of the "docker compose" containers below — so "localhost" from inside
|
||||
# the job container is NOT the Docker host and can't reach the published
|
||||
@@ -31,7 +36,10 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Start dependency stack
|
||||
run: docker compose up -d postgres redis minio
|
||||
run: |
|
||||
docker network prune -f || true
|
||||
docker compose down --remove-orphans -v || true
|
||||
docker compose up -d --remove-orphans postgres redis minio
|
||||
|
||||
- name: Wait for Postgres
|
||||
run: |
|
||||
@@ -91,7 +99,7 @@ jobs:
|
||||
|
||||
- name: Tear down stack
|
||||
if: always()
|
||||
run: docker compose down -v
|
||||
run: docker compose down --remove-orphans -v
|
||||
|
||||
frontend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# CI override: attach deps to the host's built-in bridge instead of creating a
|
||||
# new user-defined network. Busy act_runners often hit
|
||||
# "all predefined address pools have been fully subnetted" when every job
|
||||
# allocates a fresh subnet. Tests reach Postgres/Redis/MinIO via published
|
||||
# ports on host.docker.internal, so service-name DNS is not required.
|
||||
networks:
|
||||
vigilcare:
|
||||
external: true
|
||||
name: bridge
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { mount, flushPromises } from '@vue/test-utils'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { mount, flushPromises, type VueWrapper } from '@vue/test-utils'
|
||||
import { createPinia, setActivePinia } from 'pinia'
|
||||
import CoverSheetView from '@/views/CoverSheetView.vue'
|
||||
|
||||
@@ -62,6 +62,16 @@ import { get, post } from '@/api/client'
|
||||
const mockedGet = vi.mocked(get)
|
||||
const mockedPost = vi.mocked(post)
|
||||
|
||||
const mountOpts = {
|
||||
global: {
|
||||
stubs: {
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
let wrapper: VueWrapper | undefined
|
||||
|
||||
beforeEach(() => {
|
||||
setActivePinia(createPinia())
|
||||
vi.clearAllMocks()
|
||||
@@ -104,34 +114,27 @@ beforeEach(() => {
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
wrapper = undefined
|
||||
})
|
||||
|
||||
describe('CoverSheetView', () => {
|
||||
it('renders generate form, preview, and cover sheet list', async () => {
|
||||
const wrapper = mount(CoverSheetView, {
|
||||
global: {
|
||||
stubs: {
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
},
|
||||
},
|
||||
})
|
||||
wrapper = mount(CoverSheetView, mountOpts)
|
||||
await flushPromises()
|
||||
|
||||
expect(wrapper.text()).toContain('Generate Cover Sheets')
|
||||
expect(wrapper.text()).toContain('Preview')
|
||||
expect(wrapper.find('h2').exists()).toBe(true)
|
||||
expect(wrapper.get('h2').text()).toContain('Generate Cover Sheets')
|
||||
expect(wrapper.find('.cover-sheet-preview').exists()).toBe(true)
|
||||
expect(wrapper.text()).toContain('Existing Cover Sheets')
|
||||
expect(wrapper.text()).toContain('VCR-CS-AABBCCDD')
|
||||
expect(wrapper.find('.cover-sheet-preview').exists()).toBe(true)
|
||||
expect(wrapper.find('[data-testid="status-badge"]').text()).toBe('UNUSED')
|
||||
expect(wrapper.get('[data-testid="status-badge"]').text()).toBe('UNUSED')
|
||||
expect(wrapper.find('select').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('loads entry clerks and cover sheets on mount', async () => {
|
||||
mount(CoverSheetView, {
|
||||
global: {
|
||||
stubs: {
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
},
|
||||
},
|
||||
})
|
||||
wrapper = mount(CoverSheetView, mountOpts)
|
||||
await flushPromises()
|
||||
|
||||
expect(mockedGet).toHaveBeenCalledWith('users', { role: 'DATA_ENTRY_CLERK' })
|
||||
@@ -149,13 +152,7 @@ describe('CoverSheetView', () => {
|
||||
error: null,
|
||||
})
|
||||
|
||||
const wrapper = mount(CoverSheetView, {
|
||||
global: {
|
||||
stubs: {
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
},
|
||||
},
|
||||
})
|
||||
wrapper = mount(CoverSheetView, mountOpts)
|
||||
await flushPromises()
|
||||
|
||||
const batchTypeSelect = wrapper.findAll('select')[0]
|
||||
@@ -185,13 +182,7 @@ describe('CoverSheetView', () => {
|
||||
error: null,
|
||||
})
|
||||
|
||||
const wrapper = mount(CoverSheetView, {
|
||||
global: {
|
||||
stubs: {
|
||||
RouterLink: { template: '<a><slot /></a>' },
|
||||
},
|
||||
},
|
||||
})
|
||||
wrapper = mount(CoverSheetView, mountOpts)
|
||||
await flushPromises()
|
||||
|
||||
await wrapper.findAll('select')[0].setValue('LAB_RESULTS')
|
||||
|
||||
@@ -376,12 +376,12 @@ const assignedClerkLabel = computed(() => {
|
||||
return clerk?.fullName ?? 'Selected'
|
||||
})
|
||||
|
||||
const previewTimestamp = computed(() =>
|
||||
new Date().toLocaleString(undefined, {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
}),
|
||||
)
|
||||
const previewTimestamp = computed(() => {
|
||||
// Avoid dateStyle/timeStyle — slow / flaky under minimal ICU in CI jsdom.
|
||||
const d = new Date()
|
||||
return `${d.toLocaleDateString()} ${d.toLocaleTimeString()}`
|
||||
})
|
||||
|
||||
|
||||
function formatBatchType(type: string): string {
|
||||
return type.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase())
|
||||
|
||||
@@ -14,6 +14,10 @@ export default defineConfig({
|
||||
globals: true,
|
||||
setupFiles: ['./src/__tests__/setup.ts'],
|
||||
exclude: ['**/node_modules/**', '**/e2e/**', '**/dist/**'],
|
||||
// Gitea act_runner jsdom mounts can exceed the 5s default under load.
|
||||
testTimeout: 15_000,
|
||||
hookTimeout: 15_000,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user