mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Adds Karma to TravisCI
- Updates travis to run karma - Adds some actual tests Sample build success: https://travis-ci.org/djvirgen/kubernetes/jobs/61567253 Note: My branch is currently up to date with master but all the Go stuff is failing in Travis. Not sure why Go is failing, but the Karma stuff is running OK. I've also verified that when a Jasmine test fails, Travis will fail the build (see [this build](https://travis-ci.org/djvirgen/kubernetes/jobs/61567666) here).
This commit is contained in:
parent
e73fa8b8b0
commit
1a784cd489
3
.gitignore
vendored
3
.gitignore
vendored
@ -53,3 +53,6 @@ network_closure.sh
|
||||
|
||||
# Web UI
|
||||
www/master/node_modules/
|
||||
|
||||
# Karma output
|
||||
www/test_out
|
||||
|
@ -21,8 +21,12 @@ install:
|
||||
- GOPATH=$PWD/Godeps/_workspace:$GOPATH go install ./...
|
||||
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/verify-gendocs.sh
|
||||
|
||||
before_script:
|
||||
- npm install karma karma-junit-reporter karma-phantomjs-launcher karma-jasmine
|
||||
|
||||
script:
|
||||
- KUBE_RACE="-race" KUBE_COVER="y" KUBE_GOVERALLS_BIN="$HOME/gopath/bin/goveralls" KUBE_TIMEOUT='-timeout 300s' KUBE_COVERPROCS=8 KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS ./hack/test-go.sh -- -p=2
|
||||
- node_modules/karma/bin/karma start www/master/karma.conf.js --single-run --browsers PhantomJS
|
||||
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH ./hack/test-cmd.sh
|
||||
- PATH=$HOME/gopath/bin:./third_party/etcd:$PATH KUBE_TEST_API_VERSIONS=$KUBE_TEST_API_VERSIONS KUBE_INTEGRATION_TEST_MAX_CONCURRENCY=4 LOG_LEVEL=4 ./hack/test-integration.sh
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
'use strict';
|
||||
|
||||
describe('header controller', function() {
|
||||
beforeEach(module('kubernetesApp.components.dashboard'));
|
||||
|
||||
beforeEach(inject(function($rootScope, $location, $controller) {
|
||||
this.rootScope = $rootScope;
|
||||
this.scope = $rootScope.$new();
|
||||
|
||||
this.location = $location;
|
||||
spyOn(this.location, 'path');
|
||||
|
||||
this.controller = $controller;
|
||||
this.ctrl = this.controller('HeaderCtrl', {
|
||||
$scope: this.scope
|
||||
});
|
||||
this.scope.$apply();
|
||||
}));
|
||||
|
||||
describe('subPages', function() {
|
||||
it('is defined', function() {
|
||||
expect(this.scope.subPages).not.toBeUndefined();
|
||||
});
|
||||
|
||||
it('is an array', function() {
|
||||
expect(Array.isArray(this.scope.subPages)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('is not empty', function() {
|
||||
expect(this.scope.subPages.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
describe('each subPage', function() {
|
||||
it('has a category', function() {
|
||||
this.scope.subPages.forEach(function(subPage) {
|
||||
expect(subPage.category).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
it('has a name', function() {
|
||||
this.scope.subPages.forEach(function(subPage) {
|
||||
expect(subPage.name).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
it('has a value', function() {
|
||||
this.scope.subPages.forEach(function(subPage) {
|
||||
expect(subPage.value).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Pages', function() {
|
||||
it('does not change location on first detected change', function() {
|
||||
expect(this.location.path).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('changes location on second detected change', function() {
|
||||
var _this = this;
|
||||
this.scope.$apply(function() {
|
||||
_this.scope.Pages = 'test_Pages';
|
||||
});
|
||||
expect(this.location.path).toHaveBeenCalledWith('test_Pages');
|
||||
});
|
||||
});
|
||||
});
|
@ -27,7 +27,14 @@ module.exports = function(config) {
|
||||
|
||||
browsers: ['Chrome'],
|
||||
|
||||
plugins: ['karma-chrome-launcher', 'karma-firefox-launcher', 'karma-jasmine', 'karma-junit-reporter'],
|
||||
plugins: [
|
||||
'karma-chrome-launcher',
|
||||
'karma-firefox-launcher',
|
||||
'karma-jasmine',
|
||||
'karma-junit-reporter',
|
||||
'karma-story-reporter',
|
||||
'karma-phantomjs-launcher'
|
||||
],
|
||||
|
||||
junitReporter: {outputFile: 'test_out/unit.xml', suite: 'unit'}
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
"karma-cli": "0.0.4",
|
||||
"karma-jasmine": "^0.1.5",
|
||||
"karma-junit-reporter": "^0.2.2",
|
||||
"karma-story-reporter": "^0.3.1",
|
||||
"protractor": "^1.1.1",
|
||||
"shelljs": "^0.2.6",
|
||||
"through2": "^0.6.3",
|
||||
|
Loading…
Reference in New Issue
Block a user