Skip to content

Commit 626a8da

Browse files
authored
Merge pull request #33 from figma/yfang/copy-commits-from-michaelnyu-ci-queue
Merge all commits from michaelnyu/ci-queue
2 parents 9340e5c + be257f9 commit 626a8da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1301
-164
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: bundler
4+
directory: "/ruby/"
5+
schedule:
6+
interval: weekly
7+
time: "14:00"
8+
open-pull-requests-limit: 100
9+
insecure-external-code-execution: allow
10+
registries: "*"
11+
groups:
12+
minor-gem-update:
13+
update-types:
14+
- "minor"
15+
patch-gem-update:
16+
update-types:
17+
- "patch"

.github/workflows/cla.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .github/workflows/cla.yml
2+
name: Contributor License Agreement (CLA)
3+
4+
on:
5+
pull_request_target:
6+
types: [opened, synchronize]
7+
issue_comment:
8+
types: [created]
9+
10+
jobs:
11+
cla:
12+
runs-on: ubuntu-latest
13+
if: |
14+
(github.event.issue.pull_request
15+
&& !github.event.issue.pull_request.merged_at
16+
&& contains(github.event.comment.body, 'signed')
17+
)
18+
|| (github.event.pull_request && !github.event.pull_request.merged)
19+
steps:
20+
- uses: Shopify/shopify-cla-action@v1
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
cla-token: ${{ secrets.CLA_TOKEN }}

.github/workflows/tests.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,18 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
ruby: [ '2.7', '3.0', '3.1', '3.2' ]
18+
ruby:
19+
- '2.7'
20+
- '3.0'
21+
- '3.1'
22+
- '3.2'
23+
- '3.3.0'
24+
- 'truffleruby'
1925
steps:
2026
- uses: actions/checkout@v2
27+
- name: Install deps
28+
run: |
29+
sudo apt-get install libsnappy-dev
2130
- name: Set up Ruby ${{ matrix.ruby }}
2231
uses: ruby/setup-ruby@v1
2332
with:

.spin/packages.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- libsnappy-dev

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Gem Version](https://badge.fury.io/rb/ci-queue.svg)](https://rubygems.org/gems/ci-queue)
44
[![Tests](https://github.com/Shopify/ci-queue/workflows/Tests/badge.svg?branch=master)](https://github.com/Shopify/ci-queue/actions?query=workflow%3ATests)
55

6-
Distribute tests over many workers using a queue.
6+
Distribute tests over many workers using a queue.
77

88
## Why a queue?
99

@@ -24,7 +24,7 @@ Additionally, a separate process can be started to centralize the error reportin
2424
## What are requeues?
2525

2626
When working on big test suites, it's not uncommon for a few tests to fail intermittently, either because they are inherently flaky,
27-
or because they are sensible to other tests modifying some global state (leaky tests).
27+
or because they are sensitive to other tests modifying some global state (leaky tests).
2828

2929
In this context, it is useful to have mitigation measures so that these intermittent failures don't cause unrelated builds to fail until the root cause is addressed.
3030

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
---
12
# This file is for Shopify employees development environment.
23
# If you are an external contributor you don't have to bother with it.
4+
35
name: ci-queue
46

5-
vm:
6-
ip_address: 192.168.64.245
7-
memory: 1G
8-
cores: 2
9-
services:
10-
- redis
7+
up:
8+
- snappy

python/ciqueue/_pytest/outcomes.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ class UnserializableException(Exception):
4242
Failed: outcomes.Failed}
4343

4444

45+
try:
46+
from_exc_info = code.ExceptionInfo.from_exc_info
47+
except AttributeError:
48+
# pytest < 7.4
49+
def from_exc_info(tup):
50+
return code.ExceptionInfo(tup)
51+
52+
4553
def swap_in_serializable(excinfo):
4654
def pickles(excinfo):
4755
try:
@@ -52,22 +60,22 @@ def pickles(excinfo):
5260
if excinfo.type in SERIALIZE_TYPES:
5361
cls = SERIALIZE_TYPES[excinfo.type]
5462
tup = (cls, cls(*excinfo.value.args), excinfo.tb)
55-
excinfo = code.ExceptionInfo(tup)
63+
excinfo = from_exc_info(tup)
5664
elif not pickles(excinfo):
5765
tup = (UnserializableException,
5866
UnserializableException(
5967
"Actual Exception thrown on test node was %r" %
6068
excinfo.value),
6169
excinfo.tb)
62-
excinfo = code.ExceptionInfo(tup)
70+
excinfo = from_exc_info(tup)
6371
return excinfo
6472

6573

6674
def swap_back_original(excinfo):
6775
if excinfo.type in DESERIALIZE_TYPES:
6876
tipe = DESERIALIZE_TYPES[excinfo.type]
6977
tup = (tipe, tipe(*excinfo.value.args), excinfo.tb)
70-
return code.ExceptionInfo(tup)
78+
return from_exc_info(tup)
7179
return excinfo
7280

7381

@@ -84,4 +92,4 @@ def failed(item):
8492
def skipped_excinfo(item, msg):
8593
traceback = list(item.error_reports.values())[0]['excinfo'].tb
8694
tup = (outcomes.Skipped, outcomes.Skipped(msg), traceback)
87-
return code.ExceptionInfo(tup)
95+
return from_exc_info(tup)

python/ciqueue/_pytest/test_queue.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def parse_redis_args(spec):
5252
result['socket_connect_timeout'] = int(query['socket_connect_timeout'][0])
5353
if 'retry_on_timeout' in query:
5454
result['retry_on_timeout'] = bool(util.strtobool(query['retry_on_timeout'][0] or 'false'))
55+
if spec.scheme == "rediss":
56+
result['ssl'] = True
5557

5658
return result
5759

@@ -62,7 +64,7 @@ def build_queue(queue_url, tests_index=None):
6264
return ciqueue.Static(spec.path.split(':'))
6365
elif spec.scheme == 'file':
6466
return ciqueue.File(spec.path)
65-
elif spec.scheme == 'redis':
67+
elif spec.scheme == 'redis' or spec.scheme == 'rediss':
6668
redis_args = parse_redis_args(spec)
6769
redis_client = redis.StrictRedis(**redis_args)
6870

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def get_lua_scripts():
3737
packages=['ciqueue', 'ciqueue._pytest'],
3838
install_requires=[
3939
'dill>=0.2.7',
40-
'pytest>=2.7,<7',
40+
'pytest>=2.7',
4141
'redis>=2.10.5',
4242
'tblib>=1.3.2',
4343
'uritools>=2.0.0',

python/tests/test_pytest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
import os
2+
import re
23
import subprocess
34
import redis
5+
import pytest
46

57
# pylint: disable=no-self-use
68

79

10+
@pytest.fixture(autouse=True)
11+
def change_test_dir(request, monkeypatch):
12+
monkeypatch.chdir(request.fspath.dirname + "/..")
13+
14+
815
def expected_messages(output):
916
assert '= 4 failed, 2 passed, 1 skipped, 1 xpassed, 6 errors in' in output, output
10-
assert ('integrations/pytest/test_all.py:27: skipping test message' in output
11-
or 'integrations/pytest/test_all.py:28: skipping test message' in output), output
17+
assert re.search(r':\d+: skipping test message', output) is not None, \
18+
"did not find 'skipping test message' in output"
1219

1320

1421
def check_output(cmd):

0 commit comments

Comments
 (0)