grafana / grafana/xk6-sql

MySQL values returned as arrays of ASCII integers

Open
#12 2 comments 1 reaction 0 assignees View on GitHub
bug evaluation needed
Dominant language
Go
Stars
190
Forks
65
Avg merge
2d 11h
Merged PRs (30d)
10

Description

# Versions
- [x] k6 v0.36.0 ((devel), go1.17.7, linux/amd64)
- [x] Dockerized mariadb@10.3

# What
On table of 926 rows named `filled_table`;

## SELECT *

```js
export default function () {
const results = sql.query(db, 'SELECT * FROM filled_table;');
check(results, {
'is length 926': (r) => r.length === 926
});
}
```

```bash
% ./k6 run script.js

/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io

WARN[0000] Module 'k6/x/sql' is using deprecated APIs that will be removed in k6 v0.38.0, for more details on how to update it see https://k6.io/docs/extensions/guides/create-an-extension/#advanced-javascript-extension
execution: local
script: script.js
output: -

scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.0s/10m0s 1/1 iters, 1 per VU

✓ is length 926

checks...............: 100.00% ✓ 1 ✗ 0
data_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=8.29ms min=8.29ms med=8.29ms max=8.29ms p(90)=8.29ms p(95)=8.29ms
iterations...........: 1 98.862097/s
```

## SELECT count

```js
export default function () {
const results = sql.query(db, 'SELECT count(*) FROM filled_table;');
console.log(JSON.stringify(results))
check(results, {
'is length 926': (r) => r.length === 926
});
}
```

```bash
% ./k6 run script.js

/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io

WARN[0000] Module 'k6/x/sql' is using deprecated APIs that will be removed in k6 v0.38.0, for more details on how to update it see https://k6.io/docs/extensions/guides/create-an-extension/#advanced-javascript-extension
execution: local
script: script.js
output: -

scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

INFO[0000] [{"count(*)":[57,50,54]}] source=console

running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.0s/10m0s 1/1 iters, 1 per VU

✗ is length 926
↳ 0% — ✓ 0 / ✗ 1

checks...............: 0.00% ✓ 0 ✗ 1
data_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=4.88ms min=4.88ms med=4.88ms max=4.88ms p(90)=4.88ms p(95)=4.88ms
iterations...........: 1 148.411992/s
```

## SELECT TABLE_ROWS

```js
export default function () {
const results = sql.query(db, 'SELECT TABLE_ROWS FROM information_schema.TABLES WHERE TABLE_NAME = "filled_table";');
console.log(JSON.stringify(results))
check(results, {
'is length 926': (r) => r.length === 926
});
}
```

```bash
% ./k6 run script.js

/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io

WARN[0000] Module 'k6/x/sql' is using deprecated APIs that will be removed in k6 v0.38.0, for more details on how to update it see https://k6.io/docs/extensions/guides/create-an-extension/#advanced-javascript-extension
execution: local
script: script.js
output: -

scenarios: (100.00%) 1 scenario, 1 max VUs, 10m30s max duration (incl. graceful stop):
* default: 1 iterations for each of 1 VUs (maxDuration: 10m0s, gracefulStop: 30s)

INFO[0000] [{"TABLE_ROWS":[57,50,54]}] source=console

running (00m00.0s), 0/1 VUs, 1 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs 00m00.0s/10m0s 1/1 iters, 1 per VU

✗ is length 926
↳ 0% — ✓ 0 / ✗ 1

checks...............: 0.00% ✓ 0 ✗ 1
data_received........: 0 B 0 B/s
data_sent............: 0 B 0 B/s
iteration_duration...: avg=4.88ms min=4.88ms med=4.88ms max=4.88ms p(90)=4.88ms p(95)=4.88ms
iterations...........: 1 148.411992/s
```

# Observation
Logging the response of both `SELECT count(*)` and `SELECT TABLE_ROWS` show us the same responses.

```bash
[{"count(*)":[57,50,54]}]
// OR
[{"TABLE_ROWS":[57,50,54]}]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.