瀏覽代碼

Vagrant testing support

jamesread 4 年之前
父節點
當前提交
8e3112ee16

+ 1 - 0
integration-tests/.gitignore

@@ -1,2 +1,3 @@
 results
 node_modules
+.vagrant

+ 35 - 0
integration-tests/Vagrantfile

@@ -0,0 +1,35 @@
+# This Vagrantfile is designed to be used with artifacts that have been built by goreleaser.
+# (eg, snapshot builds on GitHub)
+
+
+Vagrant.configure("2") do |config| 
+  config.vm.box = "generic/centos8"
+  config.vm.provision "shell", inline: "mkdir /etc/OliveTin && chmod o+w /etc/OliveTin/", privileged: true
+  config.vm.provision "file", source: "configs/config.general.yaml/.", destination: "/etc/OliveTin/config.yaml"
+
+  config.vm.provider :libvirt do |libvirt|
+    libvirt.management_network_device = 'virbr0'
+  end
+
+  config.vm.define :f34 do |f34|
+    f34.vm.box = "generic/fedora34"
+    f34.vm.provision "file", source: "/opt/OliveTin-vagrant/linux_amd64_rpm/.", destination: "."
+    f34.vm.provision "shell", inline: "rpm -U OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld"
+  end
+
+  config.vm.define :debian do |debian|
+    debian.vm.box = "generic/debian10"
+    debian.vm.provision "file", source: "/opt/OliveTin-vagrant/linux_amd64_deb/.", destination: "."
+    debian.vm.provision "shell", inline: "dpkg --force-confold -i OliveTin* && systemctl enable --now OliveTin"
+  end
+
+  config.vm.define :ubuntu do |ubuntu|
+    ubuntu.vm.box = "generic/ubuntu2110"
+    ubuntu.vm.provision "file", source: "/opt/OliveTin-vagrant/linux_amd64_deb/.", destination: "."
+    ubuntu.vm.provision "shell", inline: "dpkg --force-confold -i OliveTin* && systemctl enable --now OliveTin && systemctl disable --now firewalld"
+  end
+
+  # TODO
+  #
+
+end

+ 4 - 22
integration-tests/configs/config.general.yaml

@@ -1,23 +1,17 @@
-# There is a built-in micro proxy that will host the webui and REST API all on 
-# one port (this is called the "Single HTTP Frontend") and means you just need 
-# one open port in the container/firewalls/etc. 
 #
-# Listen on all addresses available, port 1337
+# Integration Test Config: General
+# 
+
 listenAddressSingleHTTPFrontend: 0.0.0.0:1337 
 
-# Choose from INFO (default), WARN and DEBUG
 logLevel: "DEBUG"
+checkForUpdates: false 
 
-# Actions (buttons) to show up on the WebUI:
 actions:   
-  # This will send 1 ping (-c 1)
-  # Docs: https://docs.olivetin.app/action-ping.html
 - title: Ping Google.com
   shell: ping google.com -c 1
   icon: ping
   
-  # Restart lightdm on host "overseer"
-  # Docs: https://docs.olivetin.app/action-ping.html
 - title: restart lightdm
   icon: poop
   shell: ssh root@overseer 'service lightdm restart'
@@ -30,23 +24,11 @@ actions:
   shell: sleep 5
   icon: "&#x1F62A"
 
-  # OliveTin can run long-running jobs like Ansible playbooks. 
-  # 
-  # For such jobs, you will need to install ansible-playbook on the host where
-  # you are running OliveTin, or in the container.
-  #
-  # You probably want a much longer timeout as well (so that ansible completes).
 - title: "Run Ansible Playbook"
   icon: "&#x1F1E6"
   shell: ansible-playbook -i /etc/hosts /root/myRepo/myPlaybook.yaml
   timeout: 120
 
-  # OliveTin can control containers - docker is just a command line app.
-  # 
-  # However, if you are running in a container you will need to do some setup,
-  # see the docs below.
-  #
-  # Docs: https://docs.olivetin.app/action-container-control.html
 - title: Restart Plex
   icon: smile
   shell: docker restart plex

+ 4 - 4
integration-tests/configs/config.hiddenNav.yaml

@@ -1,11 +1,11 @@
-# There is a built-in micro proxy that will host the webui and REST API all on 
-# one port (this is called the "Single HTTP Frontend") and means you just need 
-# one open port in the container/firewalls/etc. 
 #
-# Listen on all addresses available, port 1337
+# Integration Test Config: General
+# 
+
 listenAddressSingleHTTPFrontend: 0.0.0.0:1337 
 
 hideNavigation: true
+checkForUpdates: false 
 
 # Actions (buttons) to show up on the WebUI:
 actions:   

+ 1 - 1
integration-tests/cypress/integration/general/defaultHomepageRender.spec.js

@@ -12,7 +12,7 @@ describe('Homepage rendering', () => {
   })
 
   it('Switcher navigation is visible', () => {
-    cy.get('#switcher').then($el => {
+    cy.get('#sectionSwitcher').then($el => {
       expect(Cypress.dom.isHidden($el)).to.be.false
     })
   })

+ 12 - 0
integration-tests/cypressRunVagrant.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# args:
+# $1: The Vagrant VM to test against. If blank and only one VM is provisioned, it will use that.
+
+IP=$(vagrant ssh-config $1 | grep HostName | awk '{print $2}')
+BASE_URL="http://$IP:1337/"
+
+echo "IP: $IP, BaseURL: $BASE_URL"
+
+# Only run the general test, as we cannot easily switch out configs in VMs yet.
+./node_modules/.bin/cypress run --headless -c baseUrl=$BASE_URL -s cypress/integration/general/*