Skip to content

Commit 66b77f0

Browse files
authored
Update go deps, move to go 1.19 (#291)
* Update go deps * Add retries to all windows commands * Fix for retry command * Try another way * Upgrade go to 1.19 * Add go version assertion * A diff for gofmt * Fix go version assertion * Drop some ee tests for now * Rewrite scoop installs * Add retry to yarn step * Add --force to docker remove prune * Fix for clickhouse connection * Fix for database= param test * Try weird things * Try pinning clickhouse image * Pin all images not to :latest * Fix oracle version * Correct oracle version * Try downgrading mongo? * Try deleting only this image after each run * Debug users.xml file * Try hardcoding overrides for clickhouse * Bump clickhouse down a version * Try only running clickhouse tests * Use docker style volume mount, not podman * Fix format * Drop unused users.xml file * Enable all tests * Drop io/ioutil
1 parent b734887 commit 66b77f0

32 files changed

+293
-264
lines changed

.github/workflows/ee_pull_requests.yml

+40-36
Original file line numberDiff line numberDiff line change
@@ -39,46 +39,50 @@ jobs:
3939
- run: ./scripts/require_copyright.sh
4040
- run: yarn test
4141

42-
ee_macos_tests:
43-
name: "[EE] macOS Tests"
44-
runs-on: macos-latest
42+
#
43+
# WHILE THIS CODE ISNT UNDER ACTIVE DEVELOPMENT LETS DO A MINIMUM OF TESTS ON IT.
44+
#
4545

46-
steps:
47-
- uses: actions/checkout@master
48-
with:
49-
ref: ${{ github.ref }}
46+
# ee_macos_tests:
47+
# name: "[EE] macOS Tests"
48+
# runs-on: macos-latest
5049

51-
# FROM: https://github.com/actions/cache/blob/main/examples.md#node---yarn
52-
- name: Get yarn cache directory path
53-
id: yarn-cache-dir-path
54-
run: echo "::set-output name=dir::$(yarn cache dir)"
50+
# steps:
51+
# - uses: actions/checkout@master
52+
# with:
53+
# ref: ${{ github.ref }}
5554

56-
- uses: actions/cache@v2
57-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
58-
with:
59-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
60-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
61-
restore-keys: |
62-
${{ runner.os }}-yarn-
55+
# # FROM: https://github.com/actions/cache/blob/main/examples.md#node---yarn
56+
# - name: Get yarn cache directory path
57+
# id: yarn-cache-dir-path
58+
# run: echo "::set-output name=dir::$(yarn cache dir)"
6359

64-
- run: ./scripts/ci/prepare_macos.sh
65-
- run: yarn
66-
working-directory: ee
67-
- run: yarn test
68-
working-directory: ee
60+
# - uses: actions/cache@v2
61+
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
62+
# with:
63+
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
64+
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
65+
# restore-keys: |
66+
# ${{ runner.os }}-yarn-
6967

70-
ee_windows_tests:
71-
name: "[EE] Windows Tests"
72-
runs-on: windows-latest
68+
# - run: ./scripts/ci/prepare_macos.sh
69+
# - run: yarn
70+
# working-directory: ee
71+
# - run: yarn test
72+
# working-directory: ee
7373

74-
steps:
75-
- uses: actions/checkout@master
76-
with:
77-
ref: ${{ github.ref }}
74+
# ee_windows_tests:
75+
# name: "[EE] Windows Tests"
76+
# runs-on: windows-latest
7877

79-
- run: ./scripts/ci/prepare_windows.ps1
80-
shell: pwsh
81-
- run: yarn
82-
working-directory: ee
83-
- run: yarn test
84-
working-directory: ee
78+
# steps:
79+
# - uses: actions/checkout@master
80+
# with:
81+
# ref: ${{ github.ref }}
82+
83+
# - run: ./scripts/ci/prepare_windows.ps1
84+
# shell: pwsh
85+
# - run: yarn
86+
# working-directory: ee
87+
# - run: yarn test
88+
# working-directory: ee

Dockerfile.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ FROM node:17-bullseye
33
WORKDIR /datastation
44

55
# Install Golang
6-
RUN curl -L https://go.dev/dl/go1.18.linux-amd64.tar.gz -o /tmp/go.tar.gz && tar -C /usr/local -xzf /tmp/go.tar.gz
6+
RUN curl -L https://go.dev/dl/go1.19.linux-amd64.tar.gz -o /tmp/go.tar.gz && tar -C /usr/local -xzf /tmp/go.tar.gz
77
RUN ln -s /usr/local/go/bin/go /usr/bin/go

integration/clickhouse.test.js

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const path = require('path');
12
const cp = require('child_process');
23

34
const { basicDatabaseTest } = require('../desktop/panel/testutil');
@@ -17,18 +18,26 @@ describe('basic clickhouse tests', () => {
1718
async () => {
1819
await withDocker(
1920
{
20-
image: 'docker.io/yandex/clickhouse-server:latest',
21+
image: 'docker.io/yandex/clickhouse-server:22',
2122
port: 9000,
22-
args: [
23-
'-v',
24-
__dirname +
25-
'/../scripts/ci/clickhouse_users.xml:/etc/clickhouse-server/users.d/test.xml',
26-
'--ulimit',
27-
'nofile=262144:262144',
23+
env: {
24+
CLICKHOUSE_DB: 'test',
25+
CLICKHOUSE_USER: 'test',
26+
CLICKHOUSE_PASSWORD: 'test',
27+
},
28+
cmds: [
29+
`clickhouse-client -d test -u test --password test -q 'SELECT 1'`,
2830
],
29-
cmds: [`clickhouse-client -q 'CREATE DATABASE test'`],
3031
},
31-
() => basicDatabaseTest(t)
32+
() =>
33+
basicDatabaseTest(t, {
34+
clickhouse: {
35+
database: 'test',
36+
username: 'test',
37+
password: 'test',
38+
address: 'localhost',
39+
},
40+
})
3241
);
3342
},
3443
360_000

integration/cockroachdb.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('basic cockroachdb tests', () => {
1717
async () => {
1818
await withDocker(
1919
{
20-
image: 'docker.io/cockroachdb/cockroach:latest',
20+
image: 'docker.io/cockroachdb/cockroach:v22.1.6',
2121
port: 26257,
2222
args: ['--entrypoint', 'tail'],
2323
program: ['-f', '/dev/null'],

integration/cratedb.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('basic cratedb tests', () => {
2222
async () => {
2323
await withDocker(
2424
{
25-
image: 'docker.io/library/crate:latest',
25+
image: 'docker.io/library/crate:5.0.0',
2626
port: '5439:5432',
2727
program: ['crate', '-Cdiscovery.type=single-node'],
2828
cmds: [

integration/docker.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,16 @@ module.exports.withDocker = async function (opts, cb) {
135135
cp.execSync('docker kill ' + containerId, { stdio: 'inherit' });
136136
console.log('Killed container');
137137

138+
//if (process.env.CI == 'true') {
139+
// Clear up disk space if possible since Github Actions doesn't
140+
// have a massive disk.
141+
// --force just doesn't prompt for confirmation
142+
cp.execSync('docker rmi --force ' + opts.image, { stdio: 'inherit' });
143+
//}
144+
138145
CONTAINERS[opts.image] = CONTAINERS[opts.image].filter(
139146
(c) => c === containerId
140147
);
141-
142-
if (process.env.CI == 'true') {
143-
// Clear up disk space if possible since Github Actions doesn't
144-
// have a massive disk.
145-
cp.execSync('docker image prune -a', { stdio: 'inherit' });
146-
}
147148
}
148149
};
149150

integration/mongo.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function testWithDocker(name, cb) {
2121
return withDocker(
2222
{
2323
port: 27017,
24-
image: 'docker.io/library/mongo:latest',
24+
image: 'docker.io/library/mongo:5',
2525
env: {
2626
MONGO_INITDB_ROOT_USERNAME: 'test',
2727
MONGO_INITDB_DATABASE: 'test',

integration/mysql.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('basic mysql tests', () => {
2323
async () => {
2424
await withDocker(
2525
{
26-
image: 'docker.io/library/mysql:latest',
26+
image: 'docker.io/library/mysql:8.0.30',
2727
port: '3306',
2828
env: {
2929
MYSQL_ROOT_PASSWORD: 'root',

integration/neo4j.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('basic neo4j tests', () => {
1313
test('basic test', async () => {
1414
await withDocker(
1515
{
16-
image: 'docker.io/library/neo4j:latest',
16+
image: 'docker.io/library/neo4j:4.4.10',
1717
port: 7687,
1818
env: {
1919
NEO4J_AUTH: 'neo4j/password',

integration/oracle.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('basic oracle tests', () => {
2424
async () => {
2525
await withDocker(
2626
{
27-
image: 'docker.io/gvenzl/oracle-xe:latest',
27+
image: 'docker.io/gvenzl/oracle-xe:21-slim',
2828
port: '1521',
2929
env: {
3030
ORACLE_RANDOM_PASSWORD: 'y',
@@ -46,7 +46,7 @@ describe('basic oracle tests', () => {
4646
async () => {
4747
await withDocker(
4848
{
49-
image: 'docker.io/gvenzl/oracle-xe:latest',
49+
image: 'docker.io/gvenzl/oracle-xe:21-slim',
5050
port: '1520:1521',
5151
env: {
5252
ORACLE_RANDOM_PASSWORD: 'y',
@@ -66,6 +66,6 @@ describe('basic oracle tests', () => {
6666
})
6767
);
6868
},
69-
DEFAULT_TIMEOUT
69+
DEFAULT_TIMEOUT * 10
7070
);
7171
});

integration/postgres.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('basic postgres tests', () => {
2626
async () => {
2727
await withDocker(
2828
{
29-
image: 'docker.io/library/postgres:latest',
29+
image: 'docker.io/library/postgres:14',
3030
port: '5432',
3131
env: {
3232
POSTGRES_USER: 'test',

integration/prometheus.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('basic prometheus tests', () => {
1515

1616
await withDocker(
1717
{
18-
image: 'docker.io/prom/prometheus:latest',
18+
image: 'docker.io/prom/prometheus:v2.38.0',
1919
port: '9090',
2020
args: ['-v', `${__dirname}/../testdata/prometheus:/etc/prometheus`],
2121
wait: async () => {

integration/questdb.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('basic questdb tests', () => {
2424
async () => {
2525
await withDocker(
2626
{
27-
image: 'docker.io/questdb/questdb:latest',
27+
image: 'docker.io/questdb/questdb:6.5',
2828
port: '8812',
2929
},
3030
() => basicDatabaseTest(t, vendorOverride)

integration/scylla.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('basic cassandra/scylladb tests', () => {
1313
test(`runs basic cql query`, async () => {
1414
await withDocker(
1515
{
16-
image: 'docker.io/scylladb/scylla:latest',
16+
image: 'docker.io/scylladb/scylla:5.1',
1717
port: '9042',
1818
program: [
1919
'--smp',

runner/database.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bufio"
55
"fmt"
66
"io"
7-
"io/ioutil"
87
"net"
98
"net/url"
109
"os"
@@ -224,19 +223,15 @@ func (ec EvalContext) getConnectionString(dbInfo DatabaseConnectorInfoDatabase)
224223
if genericUserPass != "" {
225224
// Already proven to be ok
226225
pass, _ := ec.decrypt(&dbInfo.Password)
227-
query = fmt.Sprintf("username=%s&password=%s&", u.username, pass)
228-
}
229-
230-
if u.database != "" {
231-
query += "database=" + u.database
226+
query = fmt.Sprintf("username=%s&password=%s", u.username, pass)
232227
}
233228

234229
if !strings.Contains(u.address, ":") {
235230
u.address += ":" + defaultPorts["clickhouse"]
236231
}
237232

238233
query += u.extraArgs
239-
return "clickhouse", fmt.Sprintf("tcp://%s?%s", u.address, query), nil
234+
return "clickhouse", fmt.Sprintf("tcp://%s/%s?%s", u.address, u.database, query), nil
240235
case SQLiteDatabase:
241236
// defined in database_sqlite.go, includes regexp support
242237
return "sqlite3_extended", resolvePath(u.database), nil
@@ -498,7 +493,7 @@ func (ec EvalContext) EvalDatabasePanelWithWriter(
498493

499494
// Copy remote sqlite database to tmp file if remote
500495
if dbInfo.Type == SQLiteDatabase && server != nil {
501-
tmp, err := ioutil.TempFile("", "sqlite-copy")
496+
tmp, err := os.CreateTemp("", "sqlite-copy")
502497
if err != nil {
503498
return err
504499
}

runner/database_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func Test_getConnectionString(t *testing.T) {
136136
{
137137
DatabaseConnectorInfoDatabase{Type: "clickhouse", Username: "jim", Password: Encrypt{Encrypted: false, Value: "pw"}, Database: "test", Address: "localhost"},
138138
"clickhouse",
139-
"tcp://localhost:9000?username=jim&password=pw&database=test",
139+
"tcp://localhost:9000/test?username=jim&password=pw",
140140
nil,
141141
"localhost",
142142
"9000",
@@ -145,7 +145,7 @@ func Test_getConnectionString(t *testing.T) {
145145
{
146146
DatabaseConnectorInfoDatabase{Type: "clickhouse", Password: Encrypt{Encrypted: false, Value: ""}, Database: "test", Address: "localhost:9001"},
147147
"clickhouse",
148-
"tcp://localhost:9001?database=test",
148+
"tcp://localhost:9001/test?",
149149
nil,
150150
"localhost",
151151
"9001",

runner/file_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package runner
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"math/rand"
76
"os"
87
"runtime"
@@ -244,7 +243,7 @@ cdef`,
244243
}
245244

246245
for _, test := range tests {
247-
inTmp, err := ioutil.TempFile("", "")
246+
inTmp, err := os.CreateTemp("", "")
248247
assert.Nil(t, err)
249248

250249
_, err = inTmp.WriteString(test)
@@ -590,7 +589,7 @@ func transformTestFile(filename string, transformFile func(string, *ResultWriter
590589
return nil, err
591590
}
592591

593-
outTmpBs, err := ioutil.ReadFile(outTmp.Name())
592+
outTmpBs, err := os.ReadFile(outTmp.Name())
594593
if err != nil {
595594
return nil, err
596595
}

0 commit comments

Comments
 (0)