[full-ci] enhancement: allow ocis to provide custom web applications (#8523)
* enhancement: allow ocis to provide custom web applications * enhancement: add an option to disable web apps * test: add default logger tests * test: add app loading tests * test: add asset server tests * enhancement: make use of dedicated app conf file and app asset paths * enhancement: adjust asset locations and deprecate WEB_ASSET_PATH * enhancement: get rid of default logger and use the service level logger instead * Apply suggestions from code review Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> * enhancement: use basename as app id * Apply suggestions from code review Co-authored-by: Martin <github@diemattels.at> * enhancement: use afero as fs abstraction * enhancement: simplify logo upload * enhancement: make use of introductionVersion field annotations --------- Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> Co-authored-by: Martin <github@diemattels.at>
This commit is contained in:
co-authored by
Benedikt Kulmann
kobergj
Martin
parent
6ba9e4adf7
commit
6814c61506
@@ -0,0 +1,34 @@
|
||||
package testenv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
// CMDTest spawns a new independent test environment
|
||||
type CMDTest struct {
|
||||
n string
|
||||
f func()
|
||||
}
|
||||
|
||||
// NewCMDTest creates a new CMDTest instance
|
||||
func NewCMDTest(name string) CMDTest {
|
||||
return CMDTest{
|
||||
n: name,
|
||||
}
|
||||
}
|
||||
|
||||
// Run runs the cmd subtest
|
||||
func (t CMDTest) Run(envs ...string) ([]byte, error) {
|
||||
cmd := exec.Command(os.Args[0], fmt.Sprintf("-test.run=%s", t.n))
|
||||
cmd.Env = append(os.Environ(), "RUN_CMD_TEST=1")
|
||||
cmd.Env = append(cmd.Env, envs...)
|
||||
|
||||
return cmd.CombinedOutput()
|
||||
}
|
||||
|
||||
// ShouldRun checks if the cmd subtest should run
|
||||
func (CMDTest) ShouldRun() bool {
|
||||
return os.Getenv("RUN_CMD_TEST") == "1"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package testenv
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
func TestNewSubTest(t *testing.T) {
|
||||
testString := "this is a sub-test"
|
||||
cmdTest := NewCMDTest(t.Name())
|
||||
if cmdTest.ShouldRun() {
|
||||
fmt.Println(testString)
|
||||
return
|
||||
}
|
||||
|
||||
out, err := cmdTest.Run()
|
||||
|
||||
g := gomega.NewWithT(t)
|
||||
g.Expect(err).ToNot(gomega.HaveOccurred())
|
||||
g.Expect(string(out)).To(gomega.ContainSubstring(testString))
|
||||
}
|
||||
Reference in New Issue
Block a user