Skip to content

Commit 79a0923

Browse files
author
Kjeld Schouten-Lebbing
authored
(tests) move back to ruby based tests (truecharts#1051)
* (tests) move back to ruby based tests * move workflow back to using Ruby
1 parent caa5147 commit 79a0923

24 files changed

+2758
-3430
lines changed

.devcontainer.json

-32
This file was deleted.

.github/workflows/apps.test.yaml

+11-36
Original file line numberDiff line numberDiff line change
@@ -123,47 +123,22 @@ jobs:
123123
# Unit-Test section
124124
##
125125

126-
# Get values for cache paths to be used in later steps
127-
- id: go-cache-paths
128-
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
129-
run: |
130-
echo "::set-output name=go-build::$(go env GOCACHE)"
131-
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
132-
133-
# Cache go build cache, used to speedup go test
134-
- name: Go Build Cache
135-
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
136-
uses: actions/cache@v2
126+
- name: Install Ruby for unittests
127+
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
128+
uses: ruby/setup-ruby@v1
137129
with:
138-
path: ${{ steps.go-cache-paths.outputs.go-build }}
139-
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
130+
ruby-version: 2.7
140131

141-
- name: Download modules
142-
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
132+
- name: Install dependencies
133+
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
143134
run: |
144-
go mod download
145-
- name: Run unit tests
146-
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
147-
run: |
148-
go test ./charts/.../tests -json | tee test.json
149-
- name: Annotate unit tests
150-
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
151-
uses: guyarb/[email protected]
152-
with:
153-
test-results: test.json
135+
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
136+
bundle install
154137
155-
- name: Parse Unit Tests
156-
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
138+
- name: Run common unit tests
139+
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
157140
run: |
158-
if grep -q "FAIL" test.json
159-
then
160-
echo "Unit Test reported FAILED";
161-
exit 1
162-
else
163-
echo "Unit Test reported OK";
164-
exit 0
165-
fi
166-
141+
bundle exec m -r tests
167142
168143
##
169144
# Chart-Testing Section

.vscode/extensions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recommendations": [
33
"ms-vscode-remote.remote-containers",
4-
"golang.go"
4+
"rebornix.ruby"
55
]
66
}

.vscode/launch.json

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
25
"version": "0.2.0",
36
"configurations": [
47
{
5-
"name": "Common",
6-
"type": "go",
8+
"name": "UnitTest - active spec file only",
9+
"type": "Ruby",
710
"request": "launch",
8-
"mode": "test",
9-
"remotePath": "",
10-
"port": 2345,
11-
"host": "127.0.0.1",
12-
"program": "${workspaceRoot}/charts/library/common/tests/",
13-
"env": {},
14-
"args": ["-test.v"],
15-
"showLog": true
11+
"cwd": "${workspaceRoot}",
12+
"program": "/usr/local/bin/bundle",
13+
"args": [
14+
"exec",
15+
"m",
16+
"-r",
17+
"${relativeFile}"
18+
]
19+
},
20+
{
21+
"name": "UnitTest - all spec files",
22+
"type": "Ruby",
23+
"request": "launch",
24+
"cwd": "${workspaceRoot}",
25+
"program": "/usr/local/bin/bundle",
26+
"args": [
27+
"exec",
28+
"m",
29+
"-r",
30+
"${workspaceFolder}/tests"
31+
]
1632
}
1733
]
1834
}

Gemfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
group :test do
6+
gem 'm'
7+
gem 'minitest'
8+
gem 'minitest-implicit-subject'
9+
gem 'minitest-reporters'
10+
gem 'pry'
11+
gem 'ruby-jq'
12+
end

go.mod

-15
This file was deleted.

0 commit comments

Comments
 (0)