不要怂,就是干,撸起袖子干!

Commit 5eebbf33 by Felix Becker Committed by Jan Aagaard Meier

Run MSSQL tests in AppVeyor (#6516)

* Make tests work on Windows

* Add AppVeyor

* Correct MSSQL error message assertion

* Remove MSSQL from Travis
1 parent 04583cf7
...@@ -21,7 +21,6 @@ env: ...@@ -21,7 +21,6 @@ env:
- DIALECT=postgres - DIALECT=postgres
- DIALECT=postgres-native - DIALECT=postgres-native
- DIALECT=sqlite - DIALECT=sqlite
- DIALECT=mssql
addons: addons:
apt: apt:
...@@ -41,7 +40,7 @@ before_script: ...@@ -41,7 +40,7 @@ before_script:
- "psql sequelize_test -c 'create extension postgis;' -U postgres" - "psql sequelize_test -c 'create extension postgis;' -U postgres"
script: script:
- "npm test" - "if [ $COVERAGE ]; then npm run coveralls; else npm run test; fi"
matrix: matrix:
include: include:
...@@ -53,8 +52,6 @@ matrix: ...@@ -53,8 +52,6 @@ matrix:
env: COVERAGE=true DIALECT=postgres-native env: COVERAGE=true DIALECT=postgres-native
- node_js: "6" - node_js: "6"
env: COVERAGE=true DIALECT=sqlite env: COVERAGE=true DIALECT=sqlite
- node_js: "6"
env: COVERAGE=true DIALECT=mssql
notifications: notifications:
webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN
# Sequelize # Sequelize
[![Build Status](https://travis-ci.org/sequelize/sequelize.svg?branch=master)](https://travis-ci.org/sequelize/sequelize) [![Build Status](https://travis-ci.org/sequelize/sequelize.svg?branch=master)](https://travis-ci.org/sequelize/sequelize)
[![Windows Build status](https://ci.appveyor.com/api/projects/status/8xhttm9pxmbmtbwb/branch/master?svg=true)](https://ci.appveyor.com/project/felixfbecker/sequelize/branch/master)
[![Coverage Status](https://coveralls.io/repos/github/sequelize/sequelize/badge.svg?branch=master)](https://coveralls.io/github/sequelize/sequelize?branch=master) [![Coverage Status](https://coveralls.io/repos/github/sequelize/sequelize/badge.svg?branch=master)](https://coveralls.io/github/sequelize/sequelize?branch=master)
[![Bountysource](https://www.bountysource.com/badge/team?team_id=955&style=bounties_received)](https://www.bountysource.com/teams/sequelize/issues?utm_source=Sequelize&utm_medium=shield&utm_campaign=bounties_received) [![Bountysource](https://www.bountysource.com/badge/team?team_id=955&style=bounties_received)](https://www.bountysource.com/teams/sequelize/issues?utm_source=Sequelize&utm_medium=shield&utm_campaign=bounties_received)
[![Slack Status](http://sequelize-slack.herokuapp.com/badge.svg)](http://sequelize.slack.com) [![Slack Status](http://sequelize-slack.herokuapp.com/badge.svg)](http://sequelize.slack.com)
......
Set-Service sqlbrowser -StartupType auto
Start-Service sqlbrowser
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null
[reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.SqlWmiManagement") | Out-Null
$wmi = New-Object('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer')
$tcp = $wmi.GetSmoObject("ManagedComputer[@Name='${env:computername}']/ServerInstance[@Name='SQL2016']/ServerProtocol[@Name='Tcp']")
$tcp.IsEnabled = $true
$tcp.Alter()
$wmi = New-Object('Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer')
$ipall = $wmi.GetSmoObject("ManagedComputer[@Name='${env:computername}']/ServerInstance[@Name='SQL2016']/ServerProtocol[@Name='Tcp']/IPAddress[@Name='IPAll']")
$port = $ipall.IPAddressProperties.Item("TcpDynamicPorts").Value
$config = @{
instanceName = "SQL2016"
host = "localhost"
username = "sa"
password = "Password12!"
port = $port
database = "master"
dialectOptions = @{
requestTimeout = 25000
cryptoCredentialsDetails = @{
ciphers = "RC4-MD5"
}
}
pool = @{
max = 5
idle = 3000
}
}
$json = $config | ConvertTo-Json -Depth 3
# cannot use Out-File because it outputs a BOM
[IO.File]::WriteAllLines((Join-Path $pwd "test\config\mssql.json"), $json)
version: '{build}'
platform:
- x64
services:
- mssql2016
shallow_clone: true
cache:
- node_modules
environment:
global:
COVERALLS_REPO_TOKEN: 751SiA6QhY5EH4P2ygq7JFWulqiD2ETXO
COVERALLS_PARALLEL: true
matrix:
- {NODE_VERSION: 4, DIALECT: mssql}
- {NODE_VERSION: 6.3, DIALECT: mssql, COVERAGE: true}
install:
- ps: Install-Product node $env:NODE_VERSION x64
- ps: |
$pkg = ConvertFrom-Json (Get-Content -Raw package.json)
$pkg.devDependencies.PSObject.Properties.Remove('sqlite3')
$pkg.devDependencies.PSObject.Properties.Remove('pg-native')
ConvertTo-Json $pkg | Out-File package.json -Encoding UTF8
- npm install
build: off
before_test:
- ps: . .\appveyor-setup.ps1
test_script:
- 'IF "%COVERAGE%" == "true" (npm run coveralls) ELSE (npm test)'
notifications:
- provider: Webhook
url: https://coveralls.io/webhook?repo_token=751SiA6QhY5EH4P2ygq7JFWulqiD2ETXO
on_build_success: true
on_build_failure: true
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
"commander": "^2.6.0", "commander": "^2.6.0",
"continuation-local-storage": "^3.1.4", "continuation-local-storage": "^3.1.4",
"coveralls": "^2.11.9", "coveralls": "^2.11.9",
"cross-env": "^2.0.1",
"dox": "~0.9.0", "dox": "~0.9.0",
"eslint": "^3.1.0", "eslint": "^3.1.0",
"git": "^0.1.5", "git": "^0.1.5",
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
"pg-hstore": "^2.3.1", "pg-hstore": "^2.3.1",
"pg-native": "^1.8.0", "pg-native": "^1.8.0",
"pg-types": "^1.11.0", "pg-types": "^1.11.0",
"rimraf": "^2.5.4",
"sinon": "^1.17.4", "sinon": "^1.17.4",
"sinon-chai": "^2.8.0", "sinon-chai": "^2.8.0",
"sqlite3": "^3.1.4", "sqlite3": "^3.1.4",
...@@ -94,45 +96,45 @@ ...@@ -94,45 +96,45 @@
"main": "index", "main": "index",
"scripts": { "scripts": {
"lint": "eslint lib test", "lint": "eslint lib test",
"test": "if [ $COVERAGE ]; then npm run coveralls; else npm run jshint && npm run teaser && npm run test-unit && npm run test-integration; fi", "test": "npm run jshint && npm run teaser && npm run test-unit && npm run test-integration",
"test-docker": "docker-compose run sequelize /bin/sh -c \"npm run test-all\"", "test-docker": "docker-compose run sequelize /bin/sh -c \"npm run test-all\"",
"test-docker-unit": "docker-compose run sequelize /bin/sh -c \"npm run test-unit-all\"", "test-docker-unit": "docker-compose run sequelize /bin/sh -c \"npm run test-unit-all\"",
"test-docker-integration": "docker-compose run sequelize /bin/sh -c \"npm run test-integration-all\"", "test-docker-integration": "docker-compose run sequelize /bin/sh -c \"npm run test-integration-all\"",
"build-docker": "docker-compose build", "build-docker": "docker-compose build",
"docs": "node docs/docs-generator.js", "docs": "node docs/docs-generator.js",
"jshint": "./node_modules/.bin/jshint lib test", "jshint": "jshint lib test",
"teaser": "echo ''; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\"; echo '# Running tests for '$DIALECT' #'; node -pe \"Array(20 + process.env.DIALECT.length + 3).join('#')\";echo '';", "teaser": "node -e \"console.log('#'.repeat(process.env.DIALECT.length + 22) + '\\n# Running tests for ' + process.env.DIALECT + ' #\\n' + '#'.repeat(process.env.DIALECT.length + 22))\"",
"test-unit": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec 'test/unit/**/*.js'", "test-unit": "mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec \"test/unit/**/*.js\"",
"test-unit-mysql": "DIALECT=mysql npm run test-unit", "test-unit-mysql": "cross-env DIALECT=mysql npm run test-unit",
"test-unit-postgres": "DIALECT=postgres npm run test-unit", "test-unit-postgres": "cross-env DIALECT=postgres npm run test-unit",
"test-unit-postgres-native": "DIALECT=postgres-native npm run test-unit", "test-unit-postgres-native": "cross-env DIALECT=postgres-native npm run test-unit",
"test-unit-sqlite": "DIALECT=sqlite npm run test-unit", "test-unit-sqlite": "cross-env DIALECT=sqlite npm run test-unit",
"test-unit-mssql": "DIALECT=mssql npm run test-unit", "test-unit-mssql": "cross-env DIALECT=mssql npm run test-unit",
"test-unit-all": "npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite", "test-unit-all": "npm run test-unit-mysql && npm run test-unit-postgres && npm run test-unit-postgres-native && npm run test-unit-mssql && npm run test-unit-sqlite",
"test-integration": "./node_modules/.bin/mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec --grep \"$GREP\" 'test/integration/**/*.test.js'", "test-integration": "mocha --globals setImmediate,clearImmediate --ui tdd --check-leaks --colors -t 30000 --reporter spec \"test/integration/**/*.test.js\"",
"test-integration-mysql": "DIALECT=mysql npm run test-integration", "test-integration-mysql": "cross-env DIALECT=mysql npm run test-integration",
"test-integration-postgres": "DIALECT=postgres npm run test-integration", "test-integration-postgres": "cross-env DIALECT=postgres npm run test-integration",
"test-integration-postgres-native": "DIALECT=postgres-native npm run test-integration", "test-integration-postgres-native": "cross-env DIALECT=postgres-native npm run test-integration",
"test-integration-sqlite": "DIALECT=sqlite npm run test-integration", "test-integration-sqlite": "cross-env DIALECT=sqlite npm run test-integration",
"test-integration-mssql": "DIALECT=mssql npm run test-integration", "test-integration-mssql": "cross-env DIALECT=mssql npm run test-integration",
"test-integration-all": "npm run test-integration-mysql && npm run test-integration-postgres && npm run test-integration-postgres-native && npm run test-integration-mssql && npm run test-integration-sqlite", "test-integration-all": "npm run test-integration-mysql && npm run test-integration-postgres && npm run test-integration-postgres-native && npm run test-integration-mssql && npm run test-integration-sqlite",
"test-mysql": "DIALECT=mysql npm test", "test-mysql": "cross-env DIALECT=mysql npm test",
"test-sqlite": "DIALECT=sqlite npm test", "test-sqlite": "cross-env DIALECT=sqlite npm test",
"test-postgres": "DIALECT=postgres npm test", "test-postgres": "cross-env DIALECT=postgres npm test",
"test-pgsql": "npm run test-postgres", "test-pgsql": "npm run test-postgres",
"test-postgres-native": "DIALECT=postgres-native npm test", "test-postgres-native": "cross-env DIALECT=postgres-native npm test",
"test-postgresn": "npm run test-postgres-native", "test-postgresn": "npm run test-postgres-native",
"test-mssql": "DIALECT=mssql npm test", "test-mssql": "cross-env DIALECT=mssql npm test",
"test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mssql", "test-all": "npm run test-mysql && npm run test-sqlite && npm run test-postgres && npm run test-postgres-native && npm run test-mssql",
"cover": "rm -rf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage", "cover": "rimraf coverage && npm run teaser && npm run cover-integration && npm run cover-unit && npm run merge-coverage",
"cover-integration": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 60000 --ui tdd 'test/integration/**/*.test.js' && mv coverage/lcov.info coverage/integration.info", "cover-integration": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 60000 --ui tdd \"test/integration/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/integration.info')\"",
"cover-unit": "COVERAGE=true ./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report lcovonly -- -t 30000 --ui tdd 'test/unit/**/*.test.js'&& mv coverage/lcov.info coverage/unit.info", "cover-unit": "cross-env COVERAGE=true node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -t 30000 --ui tdd \"test/unit/**/*.test.js\" && node -e \"require('fs').renameSync('coverage/lcov.info', 'coverage/unit.info')\"",
"merge-coverage": "./node_modules/.bin/lcov-result-merger 'coverage/*.info' 'coverage/lcov.info'", "merge-coverage": "lcov-result-merger \"coverage/*.info\" \"coverage/lcov.info\"",
"coveralls": "npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", "coveralls": "npm run cover && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rimraf ./coverage",
"sscce": "docker-compose run sequelize /bin/sh -c \"node sscce.js\"", "sscce": "docker-compose run sequelize /bin/sh -c \"node sscce.js\"",
"sscce-mysql": "DIALECT=mysql npm run sscce", "sscce-mysql": "cross-env DIALECT=mysql npm run sscce",
"sscce-postgres": "DIALECT=postgres npm run sscce", "sscce-postgres": "cross-env DIALECT=postgres npm run sscce",
"sscce-sqlite": "DIALECT=sqlite npm run sscce" "sscce-sqlite": "cross-env DIALECT=sqlite npm run sscce"
}, },
"engines": { "engines": {
"node": ">=0.6.21" "node": ">=0.6.21"
......
'use strict'; 'use strict';
const fs = require('fs');
let mssqlConfig;
try {
mssqlConfig = JSON.parse(fs.readFileSync(__dirname + '/mssql.json', 'utf8'));
} catch (e) {
// ignore
}
module.exports = { module.exports = {
username: process.env.SEQ_USER || 'root', username: process.env.SEQ_USER || 'root',
password: process.env.SEQ_PW || null, password: process.env.SEQ_PW || null,
...@@ -14,7 +22,7 @@ module.exports = { ...@@ -14,7 +22,7 @@ module.exports = {
return parseInt(Math.random() * 999, 10); return parseInt(Math.random() * 999, 10);
}, },
mssql: { mssql: mssqlConfig || {
database: process.env.SEQ_MSSQL_DB || process.env.SEQ_DB || (function () { database: process.env.SEQ_MSSQL_DB || process.env.SEQ_DB || (function () {
var db = 'sequelize-test-' + ~~(Math.random() * 100); var db = 'sequelize-test-' + ~~(Math.random() * 100);
console.log('Using database: ', db); console.log('Using database: ', db);
......
...@@ -1004,7 +1004,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() { ...@@ -1004,7 +1004,7 @@ describe(Support.getTestDialectTeaser('Sequelize'), function() {
'password authentication failed for user "bar"' 'password authentication failed for user "bar"'
].indexOf(err.message.trim()) !== -1); ].indexOf(err.message.trim()) !== -1);
} else if (dialect === 'mssql') { } else if (dialect === 'mssql') {
expect(err.message).to.match(/.*ECONNREFUSED.*/); expect(err.message).to.equal('Login failed for user \'bar\'.');
} else { } else {
expect(err.message.toString()).to.match(/.*Access\ denied.*/); expect(err.message.toString()).to.match(/.*Access\ denied.*/);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!