now using a go-like logo for the project.

This commit is contained in:
Erik Brakkee 2024-09-03 21:21:01 +02:00
parent 7798574843
commit 9508fca88f
3 changed files with 32 additions and 14 deletions

View File

@ -30,6 +30,11 @@ const (
tail -f /dev/null ` tail -f /dev/null `
clientEntryPointTemplate = ` clientEntryPointTemplate = `
echo "HOSTNAME_OF_AGENT_ON_CLIENT=agent"
echo Ready
sleep 1000000
`
clientEntryPointTemplatex = `
curl -v http://converge:8000/downloads/wsproxy > wsproxy curl -v http://converge:8000/downloads/wsproxy > wsproxy
chmod 755 wsproxy chmod 755 wsproxy
echo "{{.privateKey}}" > id_rsa echo "{{.privateKey}}" > id_rsa
@ -81,7 +86,7 @@ type IntegrationTestSuite struct {
cancelFunc context.CancelFunc cancelFunc context.CancelFunc
} }
func Test_IntergrationTestSuite(t *testing.T) { func Test_IntegrationTestSuite(t *testing.T) {
suite.Run(t, &IntegrationTestSuite{}) suite.Run(t, &IntegrationTestSuite{})
} }
@ -92,7 +97,7 @@ func (s *IntegrationTestSuite) TearDownSuite() {
} }
func (s *IntegrationTestSuite) SetupTest() { func (s *IntegrationTestSuite) SetupTest() {
ctx, cancelFunc := testsupport.CreateTestContext(context.Background(), 10*time.Second) ctx, cancelFunc := testsupport.CreateTestContext(context.Background(), 60*time.Second)
s.ctx = ctx s.ctx = ctx
s.cancelFunc = cancelFunc s.cancelFunc = cancelFunc
} }
@ -144,17 +149,22 @@ func (s *IntegrationTestSuite) runCmdFailOnError(container testcontainers.Contai
func (s *IntegrationTestSuite) defineContainer(net *testcontainers.DockerNetwork, hostname string, func (s *IntegrationTestSuite) defineContainer(net *testcontainers.DockerNetwork, hostname string,
image string, image string,
waitForLog string, logLine string,
ports []string) testcontainers.GenericContainerRequest { ports []string) testcontainers.GenericContainerRequest {
log.Printf("PORTS %v", ports) log.Printf("PORTS %v", ports)
waitStrategies := []wait.Strategy{wait.ForLog(logLine)}
if len(ports) > 0 {
waitStrategies = append(waitStrategies, wait.ForExposedPort())
}
request := testcontainers.GenericContainerRequest{ request := testcontainers.GenericContainerRequest{
ContainerRequest: testcontainers.ContainerRequest{ ContainerRequest: testcontainers.ContainerRequest{
Image: image, Image: image,
ExposedPorts: ports, ExposedPorts: ports,
Hostname: hostname, Hostname: hostname,
WaitingFor: wait.ForLog(waitForLog).WithStartupTimeout(10 * time.Second), WaitingFor: wait.ForAll(waitStrategies...).WithStartupTimeoutDefault(30 * time.Second),
LogConsumerCfg: createLogConsumerConfig(hostname), LogConsumerCfg: createLogConsumerConfig(hostname),
Networks: []string{net.Name}, Networks: []string{net.Name},
//NetworkAliases: map[string][]string{ //NetworkAliases: map[string][]string{
@ -169,7 +179,8 @@ func (s *IntegrationTestSuite) defineContainer(net *testcontainers.DockerNetwork
func (s *IntegrationTestSuite) Test_SingleAgentAndClient() { func (s *IntegrationTestSuite) Test_SingleAgentAndClient() {
net, err := network.New(s.ctx) net, err := network.New(s.ctx)
s.Nil(err) s.Require().Nil(err)
defer net.Remove(s.ctx)
// SSH key to use // SSH key to use
privateKey, publicKey, err := sshsupport.GeneratePrivatePublicKey(2048) privateKey, publicKey, err := sshsupport.GeneratePrivatePublicKey(2048)
@ -177,6 +188,7 @@ func (s *IntegrationTestSuite) Test_SingleAgentAndClient() {
// The server // The server
log.Println("Starting converge server")
converge, err := testcontainers.GenericContainer(s.ctx, converge, err := testcontainers.GenericContainer(s.ctx,
s.defineContainer(net, "converge", s.defineContainer(net, "converge",
convergeImage, convergeImage,
@ -185,12 +197,14 @@ func (s *IntegrationTestSuite) Test_SingleAgentAndClient() {
s.Require().Nil(err) s.Require().Nil(err)
err = converge.Start(s.ctx) err = converge.Start(s.ctx)
s.Require().Nil(err) s.Require().Nil(err)
defer converge.Terminate(s.ctx)
port, err := converge.MappedPort(s.ctx, "8000/tcp") port, err := converge.MappedPort(s.ctx, "8000/tcp")
s.Require().Nil(err) s.Require().Nil(err)
log.Printf("External port %v", port) log.Printf("External port %v", port)
// The agent // The agent
log.Println("Starting agent")
agentEntrypoint := testsupport.Template(agentEntryPointTemplate, agentEntrypoint := testsupport.Template(agentEntryPointTemplate,
map[string]string{"publicKey": publicKey}) map[string]string{"publicKey": publicKey})
@ -200,10 +214,14 @@ func (s *IntegrationTestSuite) Test_SingleAgentAndClient() {
"sh", "-c", agentEntrypoint} "sh", "-c", agentEntrypoint}
agent, err := testcontainers.GenericContainer(s.ctx, agentRequest) agent, err := testcontainers.GenericContainer(s.ctx, agentRequest)
s.Require().Nil(err) s.Require().Nil(err)
s.Require().Nil(agent.Start(s.ctx)) err = agent.Start(s.ctx)
log.Printf("Error from starting agent %+v", err)
s.Require().Nil(err)
defer agent.Terminate(s.ctx)
// The client // The client
log.Println("Starting client")
clientEntrypoint := testsupport.Template(clientEntryPointTemplate, clientEntrypoint := testsupport.Template(clientEntryPointTemplate,
map[string]string{"privateKey": privateKey}) map[string]string{"privateKey": privateKey})
clientRequest := s.defineContainer(net, "client", clientImage, clientRequest := s.defineContainer(net, "client", clientImage,
@ -212,13 +230,14 @@ func (s *IntegrationTestSuite) Test_SingleAgentAndClient() {
"sh", "-c", clientEntrypoint} "sh", "-c", clientEntrypoint}
client, err := testcontainers.GenericContainer(s.ctx, clientRequest) client, err := testcontainers.GenericContainer(s.ctx, clientRequest)
s.Require().Nil(err) s.Require().Nil(err)
s.Require().Nil(client.Start(s.ctx)) err = client.Start(s.ctx)
log.Printf("Error from starting client %+v", err)
s.Require().Nil(err)
defer client.Terminate(s.ctx)
input, err := client.Logs(s.ctx) input, err := client.Logs(s.ctx)
s.Require().Nil(err) s.Require().Nil(err)
inputBytes, err := io.ReadAll(input) inputBytes, err := io.ReadAll(input)
s.Require().Nil(err) s.Require().Nil(err)
s.True(strings.Contains(string(inputBytes), "HOSTNAME_OF_AGENT_ON_CLIENT=agent")) s.True(strings.Contains(string(inputBytes), "HOSTNAME_OF_AGENT_ON_CLIENT=agent"))
log.Printf("Found registry: %v", getRegistry())
} }

View File

@ -18,7 +18,7 @@ templ BasePage(tab int) {
crossorigin="anonymous"> crossorigin="anonymous">
<link rel="stylesheet" href="../static/icons/font/bootstrap-icons.css"> <link rel="stylesheet" href="../static/icons/font/bootstrap-icons.css">
<link rel="stylesheet" href="../static/css/converge.css"> <link rel="stylesheet" href="../static/css/converge.css">
<link rel="preload" as="image" href="../static/images/wamblee_logo.png"> <link rel="preload" as="image" href="../static/images/wamblee_logo_go.25.png">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@ -30,14 +30,13 @@ templ BasePage(tab int) {
</head> </head>
<body hx-boost="true" hx-ext="ws" ws-connect="../ws/sessions"> <body hx-boost="true" hx-ext="ws" ws-connect="../ws/sessions">
<div id="banner"> <div id="banner">
<img src="../static/images/wamblee_logo.png" /> <img src="../static/images/wamblee_logo_go.25.png" />
<span class="title fs-4"> <span class="title fs-4">
converge converge
<br/> <br/>
<span class="fs-5">a rendez-vous server for debugging continuous integration jobs<sup class="small">*</sup> <span class="fs-5">a rendez-vous server for debugging continuous integration jobs
</span> </span>
<br/> <br/>
<span class="verysmall text-muted">* not written in java</span>
</span> </span>
</div> </div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB