Skip to content

Commit

Permalink
Allow using local ziti edge tunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Oct 18, 2023
1 parent 17e5c31 commit e044394
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
23 changes: 23 additions & 0 deletions zititest/models/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,29 @@ var Model = &model.Model{
return nil
})
}),

model.FactoryFunc(func(m *model.Model) error {
zetPath, useLocalPath := m.GetStringVariable("local_zet_path")
return m.ForEachComponent("*", 1, func(c *model.Component) error {
if c.Type == nil {
return nil
}

if zet, ok := c.Type.(*zitilab.ZitiEdgeTunnelType); ok {
if useLocalPath {
zet.Version = ""
zet.LocalPath = zetPath
} else {
zet.Version = ZitiEdgeTunnelVersion
zet.LocalPath = ""
}
zet.InitType(c)
return nil
}

return nil
})
}),
},

Resources: model.Resources{
Expand Down
1 change: 0 additions & 1 deletion zititest/tests/scp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestScp(t *testing.T) {

req := require.New(t)
req.False(allZetHostedFailed, "all zet hosted file transfer should not failed, indicates bigger issue")

req.False(allZetClientsFailed, "all zet client file transfers should not failed, indicates bigger issue")
}

Expand Down
2 changes: 1 addition & 1 deletion zititest/zitilab/component_ziti_edge_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (self *ZitiEdgeTunnelType) Start(_ model.Run, c *model.Component) error {
configPath := fmt.Sprintf("/home/%s/fablab/cfg/%s.json", factory.User(), c.Id)
logsPath := fmt.Sprintf("/home/%s/logs/%s.log", factory.User(), c.Id)

serviceCmd := fmt.Sprintf("nohup sudo %s run -i %s > %s 2>&1 &", binaryPath, configPath, logsPath)
serviceCmd := fmt.Sprintf("sudo %s run -i %s > %s 2>&1 &", binaryPath, configPath, logsPath)

value, err := lib.RemoteExec(factory, serviceCmd)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion zititest/zitilab/component_ziti_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (self *ZitiTunnelType) Start(_ model.Run, c *model.Component) error {
useSudo = "sudo"
}

serviceCmd := fmt.Sprintf("nohup %s %s tunnel %s --log-formatter pfxlog -i %s --cli-agent-alias %s > %s 2>&1 &",
serviceCmd := fmt.Sprintf("%s %s tunnel %s --log-formatter pfxlog -i %s --cli-agent-alias %s > %s 2>&1 &",
useSudo, binaryPath, mode.String(), configPath, c.Id, logsPath)

value, err := lib.RemoteExec(factory, serviceCmd)
Expand Down

0 comments on commit e044394

Please sign in to comment.