test: add self-contained integration environment
Separate schema migrations from environment-specific fixtures, run the full API workflow against a disposable PostgreSQL Testcontainer, and provide seeded development and UI test environments. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6153017b62
commit
6969f79015
18 changed files with 772 additions and 269 deletions
|
|
@ -80,49 +80,6 @@ CREATE TABLE participant_traits (
|
|||
PRIMARY KEY (participant_id, trait_id)
|
||||
);
|
||||
|
||||
INSERT INTO users (email, password_hash, role)
|
||||
VALUES ('interviewer@go-guess.local', crypt('admin123', gen_salt('bf')), 'interviewer');
|
||||
|
||||
INSERT INTO traits (name, normalized) VALUES
|
||||
('Go', 'go'), ('PostgreSQL', 'postgresql'), ('Docker', 'docker'),
|
||||
('React', 'react'), ('TypeScript', 'typescript'), ('Kubernetes', 'kubernetes'),
|
||||
('Backend', 'backend');
|
||||
|
||||
INSERT INTO job_postings (title, description, seniority, position) VALUES
|
||||
('Senior Go Backend Engineer', 'Build reliable APIs for passenger-facing railway systems.', 'Senior', 'Backend Engineer'),
|
||||
('Full-stack Product Engineer', 'Deliver accessible operational tools from database to browser.', 'Medior', 'Full-stack Engineer');
|
||||
|
||||
INSERT INTO job_posting_labels (job_posting_id, trait_id)
|
||||
SELECT 1, id FROM traits WHERE normalized IN ('backend', 'go')
|
||||
ON CONFLICT DO NOTHING;
|
||||
INSERT INTO job_required_skills (job_posting_id, trait_id)
|
||||
SELECT 1, id FROM traits WHERE normalized IN ('go', 'postgresql', 'docker');
|
||||
INSERT INTO job_additional_skills (job_posting_id, trait_id)
|
||||
SELECT 1, id FROM traits WHERE normalized = 'kubernetes';
|
||||
|
||||
INSERT INTO job_posting_labels (job_posting_id, trait_id)
|
||||
SELECT 2, id FROM traits WHERE normalized IN ('react', 'typescript');
|
||||
INSERT INTO job_required_skills (job_posting_id, trait_id)
|
||||
SELECT 2, id FROM traits WHERE normalized IN ('go', 'react', 'typescript');
|
||||
INSERT INTO job_additional_skills (job_posting_id, trait_id)
|
||||
SELECT 2, id FROM traits WHERE normalized = 'docker';
|
||||
|
||||
INSERT INTO questions (job_id, text, type) VALUES
|
||||
(1, 'How do you design graceful shutdown for an HTTP service?', 'open'),
|
||||
(1, 'Which construct protects shared data across goroutines?', 'radio'),
|
||||
(2, 'Review this component and identify unnecessary renders.', 'code_review');
|
||||
INSERT INTO question_options (question_id, text) VALUES
|
||||
(2, 'sync.Mutex'), (2, 'context.Context'), (2, 'http.Client');
|
||||
|
||||
INSERT INTO participants (first_name, last_name, birthday, email, contact_info, cv, cv_filename) VALUES
|
||||
('Ada', 'Lovelace', '1990-12-10', 'ada@example.com', '+32 470 00 00 01', encode('Senior backend engineer with Go, PostgreSQL and Docker experience.', 'escape')::bytea, 'ada-cv.txt'),
|
||||
('Grace', 'Hopper', '1988-12-09', 'grace@example.com', '+32 470 00 00 02', encode('Full-stack developer working with Go, React and TypeScript.', 'escape')::bytea, 'grace-cv.txt');
|
||||
|
||||
INSERT INTO participant_traits (participant_id, trait_id)
|
||||
SELECT 1, id FROM traits WHERE normalized IN ('go', 'postgresql', 'docker');
|
||||
INSERT INTO participant_traits (participant_id, trait_id)
|
||||
SELECT 2, id FROM traits WHERE normalized IN ('go', 'react', 'typescript');
|
||||
|
||||
-- +goose Down
|
||||
DROP TABLE IF EXISTS participant_traits;
|
||||
DROP TABLE IF EXISTS job_additional_skills;
|
||||
|
|
|
|||
|
|
@ -2,12 +2,5 @@
|
|||
ALTER TABLE questions
|
||||
ADD COLUMN reference_answer TEXT NOT NULL DEFAULT '';
|
||||
|
||||
UPDATE questions
|
||||
SET reference_answer = CASE
|
||||
WHEN type = 'open' THEN 'Use context cancellation, stop accepting work, drain active requests, and close dependencies within a deadline.'
|
||||
WHEN type = 'code_review' THEN 'Identify unstable dependencies or state updates that cause avoidable renders and propose memoization only where measured.'
|
||||
ELSE reference_answer
|
||||
END;
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE questions DROP COLUMN reference_answer;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,5 @@
|
|||
ALTER TABLE questions
|
||||
ADD COLUMN code_snippet TEXT NOT NULL DEFAULT '';
|
||||
|
||||
UPDATE questions
|
||||
SET code_snippet = E'function CandidateList({ candidates }) {\n return candidates.map(candidate => (\n <CandidateCard candidate={candidate} />\n ));\n}'
|
||||
WHERE type = 'code_review' AND code_snippet = '';
|
||||
|
||||
-- +goose Down
|
||||
ALTER TABLE questions DROP COLUMN code_snippet;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue