@@ -33,6 +33,10 @@ const (
3333 // AppDefaultCloudConfig is a default cloud-init configuration for the VM which just
3434 // enables ssh password authentication and sets the password to "passw0rd".
3535 AppDefaultCloudConfig = "#cloud-config\n password: " + AppDefaultSSHPass + "\n chpasswd: { expire: False }\n ssh_pwauth: True\n "
36+ // Ubuntu2204 indicates the version of Ubuntu 22.04
37+ Ubuntu2204 = "22.04"
38+ // Ubuntu2004 indicates the version of Ubuntu 20.04
39+ Ubuntu2004 = "20.04"
3640)
3741
3842var (
4650 os : "ubuntu-server-cloudimg-amd64" ,
4751 version : "22.04" ,
4852 }
53+ ubuntu2004 = fixedAppInstanceConfig {
54+ appLink : "https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img" ,
55+ sshPort : "8027" ,
56+ sshUser : AppDefaultSSHUser ,
57+ sshPass : AppDefaultSSHPass ,
58+ os : "ubuntu-server-cloudimg-amd64" ,
59+ version : Ubuntu2004 ,
60+ }
4961)
5062
5163type fixedAppInstanceConfig struct {
@@ -578,6 +590,19 @@ func (node *EveNode) LogTimeInfof(format string, args ...interface{}) {
578590 }
579591}
580592
593+ // LogTimeErrorf logs an error message with a timestamp, if it is called in the context
594+ // of a test function it will call t.Fail and t.Logf, otherwise it will call fmt.Print
595+ func (node * EveNode ) LogTimeErrorf (format string , args ... interface {}) {
596+ out := utils .AddTimestampf (format + "\n " , args ... )
597+ if node .t != nil {
598+ node .t .Fail ()
599+ node .t .Logf (out )
600+ } else {
601+ fmt .Print (out )
602+ }
603+ }
604+
605+ // SetTesting sets the testing.T object for the EveNode
581606func (node * EveNode ) SetTesting (t * testing.T ) {
582607 node .t = t
583608}
0 commit comments