Skip to content

Commit 06b6e00

Browse files
committed
Add tests for end-to-end tracing attributes
1 parent 1fabc29 commit 06b6e00

File tree

3 files changed

+104
-2
lines changed

3 files changed

+104
-2
lines changed

test/end2endTracing.js

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. */
2+
3+
/******************************************************************************
4+
*
5+
* You may not use the identified files except in compliance with the Apache
6+
* License, Version 2.0 (the "License.")
7+
*
8+
* You may obtain a copy of the License at
9+
* http://www.apache.org/licenses/LICENSE-2.0.
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
*
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*
18+
* The node-oracledb test suite uses 'mocha', 'should' and 'async'.
19+
* See LICENSE.md for relevant licenses.
20+
*
21+
* NAME
22+
* 159. end2endTracing.js
23+
*
24+
* DESCRIPTION
25+
* Test settings of end-to-end tracing attributes.
26+
*
27+
*****************************************************************************/
28+
'use strict';
29+
30+
var oracledb = require('oracledb');
31+
var should = require('should');
32+
var dbConfig = require('./dbconfig.js');
33+
34+
describe('159. end2endTracing.js', function() {
35+
36+
var conn;
37+
before(function(done) {
38+
oracledb.getConnection(
39+
dbConfig,
40+
function(err, connection) {
41+
should.not.exist(err);
42+
conn = connection;
43+
done();
44+
}
45+
);
46+
});
47+
48+
after(function(done) {
49+
conn.close(function(err) {
50+
should.not.exist(err);
51+
done();
52+
});
53+
});
54+
55+
var verify = function(sql, expect, callback) {
56+
conn.execute(
57+
sql,
58+
function(err, result) {
59+
should.not.exist(err);
60+
should.strictEqual(
61+
result.rows[0][0],
62+
expect
63+
);
64+
callback();
65+
}
66+
);
67+
};
68+
69+
it('159.1 set the end-to-end tracing attribute - module', function(done) {
70+
71+
var sql = "select sys_context('userenv', 'module') from dual";
72+
var testValue = "MODULE";
73+
conn.module = testValue;
74+
verify(sql, testValue, done);
75+
76+
});
77+
78+
it('159.2 set the tracing attribute - action', function(done) {
79+
80+
var sql = "select sys_context('userenv', 'action') from dual";
81+
var testValue = "ACTION";
82+
conn.action = testValue;
83+
verify(sql, testValue, done);
84+
85+
});
86+
87+
it('159.3 set the tracing attribure - clientId', function(done) {
88+
89+
var sql = "select sys_context('userenv', 'client_identifier') from dual";
90+
var testValue = "CLIENTID";
91+
conn.clientId = testValue;
92+
verify(sql, testValue, done);
93+
94+
});
95+
});

test/list.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4077,4 +4077,9 @@ Overview of node-oracledb functional tests
40774077
158. insertAll.js
40784078
158.1 original case from the issue
40794079
158.2 inserts into one table
4080-
158.3 inserts into multiple tables
4080+
158.3 inserts into multiple tables
4081+
4082+
159. end2endTracing.js
4083+
159.1 set the end-to-end tracing attribute - module
4084+
159.2 set the tracing attribute - action
4085+
159.3 set the tracing attribure - clientId

test/opts/mocha.opts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,6 @@ test/fetchArraySize7.js
182182
test/fetchArraySize8.js
183183
test/fetchArraySize9.js
184184
test/maxRows.js
185-
test/insertAll.js
185+
test/insertAll.js
186+
187+
test/end2endTracing.js

0 commit comments

Comments
 (0)