Add template validation, fix categories
This commit is contained in:
parent
91ee360307
commit
bc26eb978e
@ -3,6 +3,8 @@ import cattle
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
# import yaml
|
||||
|
||||
|
||||
def _base():
|
||||
@ -49,12 +51,33 @@ def catalog_service(catalog_bin):
|
||||
return CatalogService(catalog_bin)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@pytest.fixture(scope='session')
|
||||
def client():
|
||||
url = 'http://localhost:8088/v1-catalog/schemas'
|
||||
return cattle.from_env(url=url)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def templates(client):
|
||||
templates = client.list_template()
|
||||
assert len(templates) > 0
|
||||
return templates
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def requests():
|
||||
return requests.Session()
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def template_details(client, templates):
|
||||
for template in templates:
|
||||
template.versionDetails = {}
|
||||
for version, link in template.versionLinks.iteritems():
|
||||
template.versionDetails[version] = client._get(link)
|
||||
return templates
|
||||
|
||||
|
||||
def test_validate_exits_normal(catalog_service):
|
||||
catalog_service.assert_retcode(
|
||||
0, '-catalogUrl',
|
||||
@ -62,6 +85,35 @@ def test_validate_exits_normal(catalog_service):
|
||||
'-validate', '-port', '18088')
|
||||
|
||||
|
||||
def test_catalog_list(client):
|
||||
templates = client.list_template()
|
||||
assert len(templates) > 0
|
||||
def test_stack_name(templates):
|
||||
hostname_label = re.compile(r'^[a-zA-Z0-9\-]{1,63}$')
|
||||
for template in templates:
|
||||
# stack_name must be a valid hostname label
|
||||
assert hostname_label.match(template.id.split(':')[-1].split('*')[-1])
|
||||
|
||||
|
||||
def test_maintainers(templates):
|
||||
maintainer = re.compile(r'^([\S]+ ){2,5}<[^@]+@[^@]+\.[^@]+>$')
|
||||
for template in templates:
|
||||
# Maintainer will soon be a requirement
|
||||
# assert template.maintainer
|
||||
if template.maintainer:
|
||||
assert maintainer.match(template.maintainer)
|
||||
|
||||
|
||||
def test_versions(templates):
|
||||
for template in templates:
|
||||
# default version must be defined
|
||||
assert template.defaultVersion
|
||||
# template with default version must be defined
|
||||
assert template.versionLinks[template.defaultVersion]
|
||||
|
||||
|
||||
def test_template_questions(template_details):
|
||||
for template in template_details:
|
||||
for _, template in template.versionDetails.iteritems():
|
||||
# there must exist a rancher-compose.yml file
|
||||
assert template.files['rancher-compose.yml']
|
||||
# rancherConfig = yaml.load(template.files['rancher-compose.yml'])
|
||||
# there must exist at least one question
|
||||
# assert len(rancherConfig['.catalog']['questions']) > 0
|
||||
|
@ -1,4 +1,5 @@
|
||||
cattle==0.5.1
|
||||
cattle==0.5.3
|
||||
pyyaml==3.11
|
||||
|
||||
flake8
|
||||
pytest==2.3.5
|
||||
pytest==2.8.7
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "K8s Example Guestbook"
|
||||
description: "It's a guestbook"
|
||||
version: 1.0.0
|
||||
category: Test
|
||||
category: Blogging
|
||||
|
@ -1,4 +1,4 @@
|
||||
name: "K8s Example WordPress"
|
||||
description: "Blogging platform"
|
||||
version: 1.0.0
|
||||
category: "Blog tool, publishing platform and CMS"
|
||||
category: Blogging
|
||||
|
@ -2,4 +2,4 @@ name: Wordpress
|
||||
description: |
|
||||
Blog tool, publishing platform and CMS
|
||||
version: latest-rancher1
|
||||
category: Blog
|
||||
category: Blogging
|
||||
|
@ -2,4 +2,4 @@ name: MongoDB
|
||||
description: |
|
||||
MongoDB Replica Set.
|
||||
version: 3.2-rancher1
|
||||
category: Database
|
||||
category: Databases
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: Alfresco
|
||||
description: |
|
||||
Slef hosted your EDM with Alfresco on few seconds.
|
||||
An ECM and BPM platform.
|
||||
version: 5.1.0
|
||||
category: EDM
|
||||
|
@ -1,6 +1,6 @@
|
||||
.catalog:
|
||||
name: Drone Rancher Node Manager
|
||||
version: 0.1.0-cloundautique1
|
||||
version: 0.1.0-cloudnautique1
|
||||
description: |
|
||||
(Experimental) Poll Rancher Metadata for Drone Agents
|
||||
and add/remove nodes accordingly.
|
||||
|
@ -2,5 +2,5 @@ name: Drone Rancher Node Manager
|
||||
description: |
|
||||
(Experimental) Dynamically add remove Drone worker nodes
|
||||
version: 0.1.0-cloudnautique1
|
||||
category: "Continuous Integration"
|
||||
category: Continuous Integration
|
||||
minimum_rancher_version: v0.56.0
|
||||
|
@ -1,6 +1,6 @@
|
||||
.catalog:
|
||||
name: "Elasticsearch"
|
||||
version: "2.2.1-rancher1"
|
||||
version: "2.2.2-rancher1"
|
||||
description: "Elasticsearch. You know, for search"
|
||||
questions:
|
||||
- variable: cluster_name
|
||||
|
@ -2,4 +2,4 @@ name: MariaDB Galera Cluster
|
||||
description: |
|
||||
(Experimental) Synchronous multi-master cluster for MariaDB
|
||||
version: 10.0.22-rancher1
|
||||
category: Database
|
||||
category: Databases
|
||||
|
@ -2,7 +2,7 @@ name: gocd-agent
|
||||
description: |
|
||||
(Experimental) Gocd agent
|
||||
version: 16.2.1-rancher1
|
||||
category: "Continuous Integration"
|
||||
category: Continuous Integration
|
||||
maintainer: "Raul Sanchez <rawmind@gmail.com>"
|
||||
minimum_rancher_version: v0.59.0
|
||||
license:
|
||||
|
@ -2,7 +2,7 @@ name: gocd-server
|
||||
description: |
|
||||
(Experimental) Gocd server
|
||||
version: 16.2.1-rancher1
|
||||
category: "Continuous Integration"
|
||||
category: Continuous Integration
|
||||
maintainer: "Raul Sanchez <rawmind@gmail.com>"
|
||||
minimum_rancher_version: v0.59.0
|
||||
license:
|
||||
|
@ -2,6 +2,6 @@ name: Janitor
|
||||
description: |
|
||||
Automatic cleanup of unused images on hosts, in order to save disk space.
|
||||
version: v1.5.2
|
||||
category: monitoring
|
||||
category: Monitoring
|
||||
maintainer: Steve Shipway <s.shipway@auckland.ac.nz>
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
name: Apache Kafka
|
||||
description: |
|
||||
(Experimental) Kafka cluster
|
||||
version: 0.8.2-rancher1
|
||||
category: clustering
|
||||
version: 0.9.0-rancher1
|
||||
category: Clustering
|
||||
maintainer: "Raul Sanchez <rawmind@gmail.com>"
|
||||
minimum_rancher_version: v0.56.0
|
||||
license:
|
||||
|
@ -2,5 +2,5 @@ name: Minecraft
|
||||
description: |
|
||||
Multiplayer block game for wasting lots of time
|
||||
version: v1.8
|
||||
category: entertainment
|
||||
category: Entertainment
|
||||
maintainer: Steve Shipway <s.shipway@auckland.ac.nz>
|
||||
|
@ -1,6 +1,6 @@
|
||||
.catalog:
|
||||
name: "Nuxeo Platform"
|
||||
version: "rancher-1.0"
|
||||
version: 8.1-rancher1
|
||||
description: |
|
||||
Enterprise Content Management
|
||||
Platform for Business Applications
|
||||
|
@ -2,5 +2,5 @@ name: Nuxeo Platform
|
||||
description: |
|
||||
Enterprise Content Management
|
||||
Platform for Business Applications
|
||||
version: 8.1
|
||||
version: 8.1-rancher1
|
||||
category: ECM
|
||||
|
@ -1,6 +1,6 @@
|
||||
.catalog:
|
||||
name: "Odoo"
|
||||
version: "0.1-educaas"
|
||||
version: v0.1-educaas
|
||||
description: "ERP management powered by Odoo"
|
||||
uuid: odoo-0
|
||||
questions:
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -1,6 +1,6 @@
|
||||
.catalog:
|
||||
name: "Taiga"
|
||||
version: "v0.1-educaas"
|
||||
version: "v0.1-educaas1"
|
||||
description: "Project management platform for agile developers"
|
||||
uuid: taiga-0
|
||||
minimum_rancher_version: v0.51.0
|
||||
|
@ -1,6 +1,6 @@
|
||||
.catalog:
|
||||
name: "Wordpress"
|
||||
version: "v0.1-educaas"
|
||||
version: "v0.1-educaas1"
|
||||
description: "Blog tool, publishing platform and CMS"
|
||||
uuid: Wordpress-0
|
||||
minimum_rancher_version: v0.51.0
|
||||
|
@ -2,4 +2,4 @@ name: Wordpress
|
||||
description: |
|
||||
Blog tool, publishing platform and CMS
|
||||
version: v0.1-educaas1
|
||||
category: Blog
|
||||
category: Blogging
|
||||
|
@ -2,7 +2,7 @@ name: Apache Zookeeper
|
||||
description: |
|
||||
(Experimental) Zookeeper cluster
|
||||
version: 3.4.6-rancher1
|
||||
category: clustering
|
||||
category: Clustering
|
||||
maintainer: "Raul Sanchez <rawmind@gmail.com>"
|
||||
minimum_rancher_version: v0.56.0
|
||||
license:
|
||||
|
Loading…
x
Reference in New Issue
Block a user