Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NH-23786: minimal passing automated tests #15

Merged
merged 10 commits into from
Oct 31, 2022
10 changes: 6 additions & 4 deletions .github/workflows/test_on_4_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ name: Run Ruby Tests on 4 Linux

on:
push:
branches:
- master
paths-ignore:
- 'test/run_tests/Dockerfile_*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

env:
GHRC: ghcr.io/appoptics/appoptics-apm-ruby/apm_ruby
GHRC: ghcr.io/solarwindscloud/solarwinds-apm-ruby/apm_ruby
xuan-cao-swi marked this conversation as resolved.
Show resolved Hide resolved
DOCKERFILE: test/run_tests/Dockerfile

jobs:
Expand Down Expand Up @@ -115,10 +117,10 @@ jobs:
- 5672:5672
options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
mongo:
image: mongo:5
image: mongo:6
ports:
- 27017:27017
options: "--health-cmd \"mongo --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'\" --health-interval 10s --health-timeout 5s --health-retries 5"
options: --health-cmd "mongosh --quiet --eval 'quit(db.runCommand({ping:1}).ok ? 0:2)'" --health-interval 10s --health-timeout 5s --health-retries 5
postgres:
image: postgres:latest
env:
Expand All @@ -140,7 +142,7 @@ jobs:

steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: print some info
run: |
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/test_on_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright (c) 2021 SolarWinds, LLC.
# All rights reserved.
xuan-cao-swi marked this conversation as resolved.
Show resolved Hide resolved

name: Run Ruby Tests on Ubuntu (Push Event)

on:
push:
branches:
- '!master'
paths-ignore:
- 'test/run_tests/Dockerfile_*'
workflow_dispatch:

env:
GHRC: ghcr.io/solarwindscloud/solarwinds-apm-ruby/apm_ruby
DOCKERFILE: test/run_tests/Dockerfile

jobs:

ubuntu_test:
name: ubuntu - ruby ${{ matrix.ruby }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby: ['3.1', '3.0', '2.7']

container:
image: ghcr.io/${{ github.repository }}/apm_ruby_ubuntu

env:
SW_APM_GEM_TEST: true
SW_APM_REPORTER: file
SW_APM_COLLECTOR: /tmp/sw_apm_traces.bson
SW_APM_REPORTER_FILE_SINGLE: false
OBOE_STAGING: true
MONGO_SERVER: "mongo"
RABBITMQ_SERVER: "rabbitmq"
MEMCACHED_SERVER: "memcached"
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
MYSQL_ROOT_PASSWORD: "admin"
MYSQL_HOST: "mysql"
MYSQL_DATABASE: "test_db"
POSTGRES_DB: "test_db"
DOCKER_MYSQL_PASS: "admin"
DOCKER_PSQL_PASS: "postgres"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST: "postgres"
QUERY_LOG_FILE: "/tmp/sw_apm_query_logs.txt"
REDIS_PASSWORD: "redis_pass"
TEST_RUNS_TO_FILE: "true"

services:
memcached:
image: memcached:latest
ports:
- 11211:11211
options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" --health-interval 10s --health-timeout 5s --health-retries 5
rabbitmq:
image: rabbitmq:latest
ports:
- 5672:5672
options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5
mongo:
image: mongo:6
ports:
- 27017:27017
options: --health-cmd "mongosh --quiet --eval 'quit(db.runCommand({ping:1}).ok ? 0:2)'" --health-interval 10s --health-timeout 5s --health-retries 5
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: "postgres"
POSTGRES_DB: test_db
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
mysql:
image: mariadb:latest
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: test_db
MYSQL_ROOT_PASSWORD: admin
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v3

- name: print some info
run: |
user=`whoami`
pwd=`pwd`
echo "User: $user"
echo "Current dir: $pwd"
echo "Home dir: $HOME"
echo "Branch: ${GITHUB_REF#refs/*/}"

- name: ruby tests
run: |
export HOME=/root
test/run_tests/ruby_setup.sh
version=`rbenv versions --bare | grep ${{ matrix.ruby }}`
rbenv global $version
echo "testing with ruby version: $version"
test/run_tests/run_tests.sh -r $version
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ gemfiles/vendor*
lib/libsolarwinds_apm.so
vendor/

# github action
.github/.DS_Store
.github/workflows/.DS_Store
8 changes: 5 additions & 3 deletions test/run_tests/Dockerfile_alpine
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.12
FROM alpine:3.16.2

VOLUME [ "/sys/fs/cgroup" ]

Expand Down Expand Up @@ -54,14 +54,16 @@ RUN apk add --upgrade \
postgresql-dev \
readline-dev \
tree \
ttf-ubuntu-font-family \
ttf-freefont \
tzdata \
vim \
wkhtmltopdf \
yaml \
zlib-dev \
&& rm -rf /var/lib/apt/lists/*

RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.8/main' >> /etc/apk/repositories && \
apk add --no-cache libcrypto1.0 libssl1.0

cheempz marked this conversation as resolved.
Show resolved Hide resolved
# rbenv setup
# use rbenv-default-gems to automatically install bundler for each ruby version
RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv \
Expand Down
10 changes: 0 additions & 10 deletions test/run_tests/Dockerfile_centos
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ RUN ln -s /usr/pgsql-14/bin/pg_config /usr/local/bin/pg_config
RUN yum groupinstall 'Development Tools' -y \
&& yum install -y \
autoconf \
# autotools-dev \
automake \
# bison \
bzip2 \
# curl \
cmake \
cyrus-sasl-devel \
cyrus-sasl-plain \
Expand All @@ -32,13 +29,6 @@ RUN yum groupinstall 'Development Tools' -y \
libjpeg \
libpng \
libpq-devel \
# libcurl4-gnutls-dev \
# libmysqlclient-dev \
# libpcre3-dev \
# libreadline-dev \
# libsasl2-dev \
# libssl-dev \
# openjdk-8-jdk \
xuan-cao-swi marked this conversation as resolved.
Show resolved Hide resolved
libXrender \
libXext \
nodejs \
Expand Down
11 changes: 3 additions & 8 deletions test/run_tests/Dockerfile_ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2019 SolarWinds, LLC.
# All rights reserved.

FROM ubuntu:18.04
FROM ubuntu:20.04

ENV TZ=America/Vancouver
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
Expand All @@ -23,18 +23,13 @@ RUN apt-get update \
git-core \
less \
libcurl4-gnutls-dev \
# libgtest-dev \
libmysqld-dev \
libmysqlclient-dev \
default-libmysqlclient-dev \
xuan-cao-swi marked this conversation as resolved.
Show resolved Hide resolved
libpq-dev \
libpcre3-dev \
libreadline-dev \
libsasl2-dev \
libsqlite3-dev \
libssl-dev \
# libssl1.0-dev \
# nodejs-dev \
# node-gyp \
nodejs \
openjdk-8-jdk \
pkg-config \
Expand Down Expand Up @@ -119,7 +114,7 @@ RUN apt-get update \
# && rm -f /tmp/config

RUN apt-get update && \
apt-get -y install mysql-client libmysqlclient-dev
apt-get -y install mysql-client default-libmysqlclient-dev


# update node to current stable version
Expand Down