-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
yaml_test.go
58 lines (51 loc) · 1.61 KB
/
yaml_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//go:build full || e2e
package main
import (
"testing"
"gopkg.in/yaml.v3"
)
const yamlConfigTemplate = `
version: "1.0"
pipes:
- from:
- username: "password_simple"
to:
host: host-password:2222
username: "user"
ignore_hostkey: true
- from:
- username: "password_.*_regex"
username_regex_match: true
to:
host: host-password:2222
username: "user"
known_hosts_data:
- fDF8RjRwTmVveUZHVEVHcEIyZ3A4RGE0WlE4TGNVPXxycVZYNU0rWTJoS0dteFphcVFBb0syRHp1TEE9IHNzaC1lZDI1NTE5IEFBQUFDM056YUMxbFpESTFOVEU1QUFBQUlPTXFxbmtWenJtMFNkRzZVT29xS0xzYWJnSDVDOW9rV2kwZGgybDlHS0psCg==
- fDF8VzRpUUd0VFVyREJwSjM3RnFuOWRwcEdVRE5jPXxEZWFna2RwVHpZZDExdDhYWXlORnlhZmROZ2c9IHNzaC1lZDI1NTE5IEFBQUFDM056YUMxbFpESTFOVEU1QUFBQUlBZnVDSEtWVGpxdXh2dDZDTTZ0ZEc0U0xwMUJ0bi9uT2VISEU1VU96UmRmCg==
- from:
- username: "publickey_simple"
authorized_keys: /tmp/auth_keys
to:
host: host-publickey:2222
username: "user"
private_key: /tmp/private_key
known_hosts_data: fDF8RjRwTmVveUZHVEVHcEIyZ3A4RGE0WlE4TGNVPXxycVZYNU0rWTJoS0dteFphcVFBb0syRHp1TEE9IHNzaC1lZDI1NTE5IEFBQUFDM056YUMxbFpESTFOVEU1QUFBQUlPTXFxbmtWenJtMFNkRzZVT29xS0xzYWJnSDVDOW9rV2kwZGgybDlHS0psCg==
- from:
- username: ".*"
username_regex_match: true
authorized_keys:
- /tmp/private_key1
- /tmp/private_key2
to:
host: host-publickey:2222
username: "user"
ignore_hostkey: true
private_key: /tmp/private_key
`
func TestYamlDecode(t *testing.T) {
var config piperConfig
err := yaml.Unmarshal([]byte(yamlConfigTemplate), &config)
if err != nil {
t.Fatalf("Failed to unmarshal yaml: %v", err)
}
}