@@ -51,6 +51,16 @@ var expectedBluemixFiles = ['manifest.yml',
51
51
'.bluemix/toolchain.yml' ,
52
52
'.bluemix/deploy.json' ]
53
53
54
+ var expectedDockerFiles = [ 'cli-config.yml' ,
55
+ '.dockerignore' ,
56
+ 'Dockerfile' ,
57
+ 'Dockerfile-tools' ]
58
+
59
+ var expectedKubernetesFiles = [ `helm/${ appName } /Chart.yaml` ,
60
+ `helm/${ appName } /values.yaml` ,
61
+ `helm/${ appName } /templates/deployment.yaml` ,
62
+ `helm/${ appName } /templates/service.yaml` ]
63
+
54
64
describe ( 'swiftserver:refresh' , function ( ) {
55
65
before ( 'set sdkgen status check delay to 1ms' , function ( ) {
56
66
// alter delay between status checks to speed up unit tests
@@ -939,6 +949,14 @@ describe('swiftserver:refresh', function () {
939
949
assert . noFile ( expectedBluemixFiles )
940
950
} )
941
951
952
+ it ( 'does not generate the docker files' , function ( ) {
953
+ assert . noFile ( expectedDockerFiles )
954
+ } )
955
+
956
+ it ( 'does not generate the kubernetes files' , function ( ) {
957
+ assert . noFile ( expectedKubernetesFiles )
958
+ } )
959
+
942
960
it ( 'does not generate any capabilities' , function ( ) {
943
961
assert . noFileContent ( `Sources/${ applicationModule } /Application.swift` , 'import SwiftMetrics' )
944
962
assert . noFileContent ( `Sources/${ applicationModule } /Application.swift` , 'import SwiftMetricsDash' )
@@ -1076,6 +1094,7 @@ describe('swiftserver:refresh', function () {
1076
1094
logger : 'helium' ,
1077
1095
port : 4567
1078
1096
} ,
1097
+ docker : true ,
1079
1098
'models' : [
1080
1099
{
1081
1100
'name' : modelName ,
@@ -1129,6 +1148,14 @@ describe('swiftserver:refresh', function () {
1129
1148
assert . file ( expectedBluemixFiles )
1130
1149
} )
1131
1150
1151
+ it ( 'generates the docker files' , function ( ) {
1152
+ assert . file ( expectedDockerFiles )
1153
+ } )
1154
+
1155
+ it ( 'generates the expected kubernetes files' , function ( ) {
1156
+ assert . file ( expectedKubernetesFiles )
1157
+ } )
1158
+
1132
1159
it ( 'defines OPENAPI_SPEC environment variable' , function ( ) {
1133
1160
assert . fileContent ( 'manifest.yml' , 'OPENAPI_SPEC: "/swagger/api"' )
1134
1161
} )
@@ -1452,12 +1479,14 @@ describe('swiftserver:refresh', function () {
1452
1479
bluemix : {
1453
1480
'name' : 'test' ,
1454
1481
'host' : 'myhost' ,
1455
- 'domain' : 'mydomain.net'
1482
+ 'domain' : 'mydomain.net' ,
1483
+ 'namespace' : 'mynamespace'
1456
1484
} ,
1457
1485
config : {
1458
1486
logger : 'helium' ,
1459
1487
port : 4567
1460
- }
1488
+ } ,
1489
+ docker : true
1461
1490
}
1462
1491
runContext = helpers . run ( path . join ( __dirname , '../../refresh' ) )
1463
1492
. withOptions ( {
@@ -1513,11 +1542,27 @@ describe('swiftserver:refresh', function () {
1513
1542
it ( 'produces the correct disk quota in the manifest' , function ( ) {
1514
1543
assert . fileContent ( 'manifest.yml' , 'disk_quota: 1024M' )
1515
1544
} )
1545
+
1546
+ it ( 'adds the proper chart-path in cli-config.yml' , function ( ) {
1547
+ assert . fileContent ( 'cli-config.yml' , 'chart-path : "helm/test"' )
1548
+ } )
1549
+
1550
+ it ( 'populates the correct name in Chart.yaml' , function ( ) {
1551
+ assert . fileContent ( 'helm/test/Chart.yaml' , 'name: test' )
1552
+ } )
1553
+
1554
+ it ( 'populates the correct values in values.yaml' , function ( ) {
1555
+ assert . fileContent ( 'helm/test/values.yaml' , 'name: test' )
1556
+ assert . fileContent ( 'helm/test/values.yaml' , 'repository: registry.mydomain.net/mynamespace/' )
1557
+ } )
1558
+
1516
1559
} )
1517
1560
1518
1561
describe ( 'Generate skeleton web application for bluemix with incorrect custom options' , function ( ) {
1519
1562
var runContext
1520
1563
1564
+ //CHRISTIAN ToDo: Add testcases for cloud-enablement with these incorrect options
1565
+
1521
1566
before ( function ( ) {
1522
1567
// Set up the spec file which should create all the necessary files for a server
1523
1568
var spec = {
@@ -1601,6 +1646,14 @@ describe('swiftserver:refresh', function () {
1601
1646
it ( 'does not generate the bluemix files' , function ( ) {
1602
1647
assert . noFile ( expectedBluemixFiles )
1603
1648
} )
1649
+
1650
+ it ( 'does not generate the docker files' , function ( ) {
1651
+ assert . noFile ( expectedDockerFiles )
1652
+ } )
1653
+
1654
+ it ( 'does not generate the kubernetes files' , function ( ) {
1655
+ assert . noFile ( expectedKubernetesFiles )
1656
+ } )
1604
1657
} )
1605
1658
1606
1659
describe ( 'Generate a web application with capabilities' , function ( ) {
@@ -2262,7 +2315,8 @@ describe('swiftserver:refresh', function () {
2262
2315
config : {
2263
2316
logger : 'helium' ,
2264
2317
port : 4567
2265
- }
2318
+ } ,
2319
+ docker : true
2266
2320
}
2267
2321
runContext = helpers . run ( path . join ( __dirname , '../../refresh' ) )
2268
2322
. withOptions ( {
@@ -2296,6 +2350,14 @@ describe('swiftserver:refresh', function () {
2296
2350
assert . file ( expectedBluemixFiles )
2297
2351
} )
2298
2352
2353
+ it ( 'generates the docker files' , function ( ) {
2354
+ assert . file ( expectedDockerFiles )
2355
+ } )
2356
+
2357
+ it ( 'generates the kubernetes files with expected values' , function ( ) {
2358
+ assert . file ( expectedKubernetesFiles )
2359
+ } )
2360
+
2299
2361
it ( 'defines example endpoints' , function ( ) {
2300
2362
var productsRoutesFile = `Sources/${ applicationModule } /Routes/ProductsRoutes.swift`
2301
2363
assert . file ( productsRoutesFile )
0 commit comments