-
Notifications
You must be signed in to change notification settings - Fork 30
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
[WIP] fix: replace missing Oralce XE image #187
Changes from 6 commits
98e17ce
b540b89
1589f4a
9888b65
3553839
1118ce8
27d141f
b4b35a1
e006d10
e8e7186
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ let DataSource = juggler.DataSource; | |
|
||
const config = require('rc')('loopback', {test: {oracle: {}}}).test.oracle; | ||
config.maxConn = 64; | ||
config.user = process.env.ORACLE_USER; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is throwing away the credentials provided by CI. |
||
config.password = process.env.ORACLE_PASSWORD; | ||
|
||
let db; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ let db, config; | |
|
||
before(function() { | ||
config = require('rc')('loopback', {dev: {oracle: {}}}).dev.oracle; | ||
config.user = process.env.ORACLE_USER; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is throwing away the credentials provided by CI. |
||
config.password = process.env.ORACLE_PASSWORD; | ||
}); | ||
|
||
after(function() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ let db; | |
describe('discoverModels', function() { | ||
before(function() { | ||
const config = require('rc')('loopback', {dev: {oracle: {}}}).dev.oracle; | ||
config.user = process.env.ORACLE_USER; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is throwing away the credentials provided by CI. |
||
config.password = process.env.ORACLE_PASSWORD; | ||
db = new DataSource(require('../'), config); | ||
}); | ||
|
||
|
@@ -97,7 +99,7 @@ describe('discoverModels', function() { | |
let others = false; | ||
models.forEach(function(m) { | ||
// console.dir(m); | ||
if (m.owner !== 'STRONGLOOP') { | ||
if (m.owner !== 'SYSTEM') { | ||
others = true; | ||
} | ||
}); | ||
|
@@ -126,7 +128,7 @@ describe('discoverModels', function() { | |
}); | ||
|
||
it('should return an array of columns for PRODUCT ', function(done) { | ||
db.discoverModelProperties('PRODUCT', {schema: 'STRONGLOOP'}, | ||
db.discoverModelProperties('PRODUCT', {schema: 'SYSTEM'}, | ||
function(err, models) { | ||
if (err) { | ||
console.error(err); | ||
|
@@ -159,9 +161,9 @@ describe('discoverModels', function() { | |
}); | ||
}); | ||
|
||
it('should return an array of primary keys for STRONGLOOP.PRODUCT', | ||
it('should return an array of primary keys for SYSTEM.PRODUCT', | ||
function(done) { | ||
db.discoverPrimaryKeys('PRODUCT', {owner: 'STRONGLOOP'}, | ||
db.discoverPrimaryKeys('PRODUCT', {owner: 'SYSTEM'}, | ||
function(err, models) { | ||
if (err) { | ||
console.error(err); | ||
|
@@ -192,9 +194,9 @@ describe('discoverModels', function() { | |
} | ||
}); | ||
}); | ||
it('should return an array of foreign keys for STRONGLOOP.INVENTORY', | ||
it('should return an array of foreign keys for SYSTEM.INVENTORY', | ||
function(done) { | ||
db.discoverForeignKeys('INVENTORY', {owner: 'STRONGLOOP'}, | ||
db.discoverForeignKeys('INVENTORY', {owner: 'SYSTEM'}, | ||
function(err, models) { | ||
if (err) { | ||
console.error(err); | ||
|
@@ -212,11 +214,11 @@ describe('discoverModels', function() { | |
|
||
describe('Discover LDL schema from a table', function() { | ||
it('should return an LDL schema for INVENTORY', function(done) { | ||
db.discoverSchema('INVENTORY', {owner: 'STRONGLOOP'}, | ||
db.discoverSchema('INVENTORY', {owner: 'SYSTEM'}, | ||
function(err, schema) { | ||
// console.log('%j', schema); | ||
assert(schema.name === 'Inventory'); | ||
assert(schema.options.oracle.schema === 'STRONGLOOP'); | ||
assert(schema.options.oracle.schema === 'SYSTEM'); | ||
assert(schema.options.oracle.table === 'INVENTORY'); | ||
assert(schema.properties.productId); | ||
assert(schema.properties.productId.type === 'String'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
-- File created - Thursday-September-05-2013 | ||
-------------------------------------------------------- | ||
DROP TABLE CUSTOMER CASCADE CONSTRAINTS PURGE; | ||
DROP TABLE SESSION CASCADE CONSTRAINTS PURGE; | ||
DROP TABLE SESS CASCADE CONSTRAINTS PURGE; | ||
DROP TABLE LOCATION CASCADE CONSTRAINTS PURGE; | ||
DROP TABLE PRODUCT CASCADE CONSTRAINTS PURGE; | ||
DROP TABLE INVENTORY CASCADE CONSTRAINTS PURGE; | ||
|
@@ -28,7 +28,7 @@ DROP TABLE RESERVATION CASCADE CONSTRAINTS PURGE; | |
"CREATED" DATE, | ||
"LASTUPDATED" DATE | ||
) ; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- DDL for Table INVENTORY | ||
-------------------------------------------------------- | ||
|
@@ -40,7 +40,7 @@ DROP TABLE RESERVATION CASCADE CONSTRAINTS PURGE; | |
"AVAILABLE" NUMBER(22,0), | ||
"TOTAL" NUMBER(22,0) | ||
) ; | ||
/ | ||
|
||
|
||
-- CREATE SEQUENCE INVENTORY_ID_SEQ START WITH 1 INCREMENT BY 1 NOMAXVALUE; | ||
-- CREATE OR REPLACE TRIGGER INVENTORY_ID_TRIGGER BEFORE | ||
|
@@ -60,7 +60,7 @@ DROP TABLE RESERVATION CASCADE CONSTRAINTS PURGE; | |
"NAME" VARCHAR2(32), | ||
"GEO" VARCHAR2(1024) | ||
) ; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- DDL for Table PRODUCT | ||
-------------------------------------------------------- | ||
|
@@ -74,7 +74,7 @@ DROP TABLE RESERVATION CASCADE CONSTRAINTS PURGE; | |
"EXTRAS" VARCHAR2(64), | ||
"FIRE_MODES" VARCHAR2(64) | ||
) ; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- DDL for Table RESERVATION | ||
-------------------------------------------------------- | ||
|
@@ -90,17 +90,17 @@ DROP TABLE RESERVATION CASCADE CONSTRAINTS PURGE; | |
"PICKUP_DATE" DATE, | ||
"RETURN_DATE" DATE | ||
) ; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- DDL for Table SESSION | ||
-- DDL for Table SESS | ||
-------------------------------------------------------- | ||
|
||
CREATE TABLE "SESSION" | ||
CREATE TABLE "SESS" | ||
( "ID" VARCHAR2(64), | ||
"UID" VARCHAR2(1024), | ||
"TTL" NUMBER | ||
) ; | ||
/ | ||
|
||
REM INSERTING into CUSTOMER | ||
SET DEFINE OFF; | ||
Insert into CUSTOMER (ID,USERNAME,EMAIL,PASSWORD,NAME,MILITARY_AGENCY,REALM,EMAILVERIFIED,VERIFICATIONTOKEN,CREDENTIALS,CHALLENGES,STATUS,CREATED,LASTUPDATED) values ('612','bat','[email protected]','$2a$10$BEG18wcYQn7TRkFIc59EB.vmnsEwqJWMlYM4DNG73iZb.MKA1rjAC',null,null,null,null,null,'[]','[]',null,null,null); | ||
|
@@ -723,7 +723,7 @@ Insert into PRODUCT (ID,NAME,AUDIBLE_RANGE,EFFECTIVE_RANGE,ROUNDS,EXTRAS,FIRE_MO | |
Insert into PRODUCT (ID,NAME,AUDIBLE_RANGE,EFFECTIVE_RANGE,ROUNDS,EXTRAS,FIRE_MODES) values ('5','M9 SD',0,75,15,'Silenced','Single'); | ||
REM INSERTING into RESERVATION | ||
SET DEFINE OFF; | ||
REM INSERTING into "SESSION" | ||
REM INSERTING into "SESS" | ||
SET DEFINE OFF; | ||
|
||
-------------------------------------------------------- | ||
|
@@ -746,31 +746,31 @@ CREATE OR REPLACE VIEW INVENTORY_VIEW | |
-------------------------------------------------------- | ||
|
||
ALTER TABLE "CUSTOMER" ADD PRIMARY KEY ("ID") ENABLE; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- Constraints for Table INVENTORY | ||
-------------------------------------------------------- | ||
|
||
ALTER TABLE "INVENTORY" ADD PRIMARY KEY ("ID") ENABLE; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- Constraints for Table LOCATION | ||
-------------------------------------------------------- | ||
|
||
ALTER TABLE "LOCATION" ADD PRIMARY KEY ("ID") ENABLE; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- Constraints for Table PRODUCT | ||
-------------------------------------------------------- | ||
|
||
ALTER TABLE "PRODUCT" ADD PRIMARY KEY ("ID") ENABLE; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- Constraints for Table SESSION | ||
-- Constraints for Table SESS | ||
-------------------------------------------------------- | ||
|
||
ALTER TABLE "SESSION" ADD PRIMARY KEY ("ID") ENABLE; | ||
/ | ||
ALTER TABLE "SESS" ADD PRIMARY KEY ("ID") ENABLE; | ||
|
||
-------------------------------------------------------- | ||
-- Ref Constraints for Table INVENTORY | ||
-------------------------------------------------------- | ||
|
@@ -779,7 +779,7 @@ CREATE OR REPLACE VIEW INVENTORY_VIEW | |
REFERENCES "LOCATION" ("ID") ENABLE; | ||
ALTER TABLE "INVENTORY" ADD CONSTRAINT "PRODUCT_FK" FOREIGN KEY ("PRODUCT_ID") | ||
REFERENCES "PRODUCT" ("ID") ENABLE; | ||
/ | ||
|
||
-------------------------------------------------------- | ||
-- Ref Constraints for Table RESERVATION | ||
-------------------------------------------------------- | ||
|
@@ -790,4 +790,4 @@ CREATE OR REPLACE VIEW INVENTORY_VIEW | |
REFERENCES "LOCATION" ("ID") ENABLE; | ||
ALTER TABLE "RESERVATION" ADD CONSTRAINT "RESERVATION_PRODUCT_FK" FOREIGN KEY ("PRODUCT_ID") | ||
REFERENCES "PRODUCT" ("ID") ENABLE; | ||
/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we need to have the
setup.sh
as the pretest, because it will imply that whoever running the tests need to use the oracle instance in docker.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we setup Oracle for CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmg, do you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is using a static test Oracle instance and injecting the credentials for the tests to pick them up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, using
source
here isn't portable. You should either run it directly (./setup.sh
) or viabash
(bash ./setup.sh
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rmg apart from an Oracle instance, we have to populate some data in it. I got
setup.sh
to do it's work (pulling the desired Oracle image, running it, and populating data), butORACLE_USER
andORACLE_PASSWORD
are not available to the app, despiteexport ORACLE_USER=SYSTEM ORACLE_PASSWORD=oracle && mocha --UV_THREADPOOL_SIZE=100 test/*.test.js node_modules/juggler-v3/test.js node_modules/juggler-v4/test.js
.On the "Environment variables" page of the project on Jenkins, there's no entry for
ORACLE_USER
andORACLE_PASSWORD
, while it is there for Cloudant, DashDB, Redis etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the static instance already has the data populated, we will not need to run
setup.sh
, just needORACLE_USER
andORACLE_PASSWORD
set in the "Environment variables" for the project.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The credentials are already provided via
rc
. The tests all have a line like this in them:That is pulling values from
~/.loopbackrc
, which is being injected in the test environment specifically to provide those credentials. The instance should already contain the test data as far as I'm aware. The purpose ofsetup.sh
was to create a local DB that matches that environment.