Skip to content

Commit

Permalink
fix tests as we dont use a wildcard anymore for globbing but exact ma…
Browse files Browse the repository at this point in the history
…tches
  • Loading branch information
ramonskie committed Dec 18, 2024
1 parent e8d9d50 commit 307cc4f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 7 deletions.
8 changes: 4 additions & 4 deletions TEST.Md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ IDS are coming from `/var/vcap/bosh/persistent_disk_hints.json`
the agent json regex
#### GCP
```
"DiskIDTransformPatern" "^(disk-.+)$",
"DiskIDTransformPattern" "^(disk-.+)$",
"DiskIDTransformReplacement": "google-${1}"
```
#### AWS:
```
"DiskIDTransformPatern": "^(vol-(.+))$",
"DiskIDTransformPattern": "^(vol-(.+))$",
"DiskIDTransformReplacement": "nvme-Amazon_Elastic_Block_Store_vol${2}"
```
#### OpenStack:
```
"DiskIDTransformPatern": "^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$",
"DiskIDTransformPattern": "^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$",
"DiskIDTransformReplacement": "scsi-${1}${2}${3}${4}${5}"
```
#### AliCloud:
```
"DiskIDTransformPatern": "^d-(.+)$",
"DiskIDTransformPattern": "^d-(.+)$",
"DiskIDTransformReplacement": "virtio-${1}"
```

Expand Down
30 changes: 30 additions & 0 deletions agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"Platform": {
"Linux": {
"CreatePartitionIfNoEphemeralDisk": true,
"PartitionerType": "parted",
"DevicePathResolutionType": "virtio",
"VirtioDevicePrefix": "google",
"ServiceManager": "systemd",
"DiskIDTransformPattern": "^(disk-.+)$",
"DiskIDTransformReplacement": "google-${1}"
}
},
"Infrastructure": {
"Settings": {
"Sources": [
{
"Type": "InstanceMetadata",
"URI": "http://169.254.169.254",
"SettingsPath": "/computeMetadata/v1/instance/attributes/bosh_settings",
"Headers": {
"Metadata-Flavor": "Google"
}
}
],

"UseServerName": true,
"UseRegistry": false
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("IDDevicePathResolver", func() {
err = fs.Symlink("/dev/intermediate/fake-device-path", "/dev/disk/by-id/virtio-fake-disk-id-include-longname")
Expect(err).ToNot(HaveOccurred())

fs.SetGlob("/dev/disk/by-id/*fake-disk-id-include-longname", []string{"/dev/disk/by-id/virtio-fake-disk-id-include-longname"})
fs.SetGlob("/dev/disk/by-id/fake-disk-id-include-longname", []string{"/dev/disk/by-id/virtio-fake-disk-id-include-longname"})
})

It("returns fully resolved the path (not potentially relative symlink target)", func() {
Expand All @@ -86,7 +86,7 @@ var _ = Describe("IDDevicePathResolver", func() {
err = fs.Symlink("fake-device-path-2", "/dev/disk/by-id/customprefix-fake-disk-id-include-longname")
Expect(err).ToNot(HaveOccurred())

fs.SetGlob("/dev/disk/by-id/*fake-disk-id-include-longname", []string{
fs.SetGlob("/dev/disk/by-id/fake-disk-id-include-longname", []string{
"/dev/disk/by-id/virtio-fake-disk-id-include-longname",
"/dev/disk/by-id/customprefix-fake-disk-id-include-longname",
})
Expand Down Expand Up @@ -132,7 +132,7 @@ var _ = Describe("IDDevicePathResolver", func() {
Expect(err).ToNot(HaveOccurred())

fs.GlobStub = func(pattern string) ([]string, error) {
fs.SetGlob("/dev/disk/by-id/*fake-disk-id-include-longname", []string{
fs.SetGlob("/dev/disk/by-id/fake-disk-id-include-longname", []string{
"/dev/disk/by-id/virtio-fake-disk-id-include-longname",
})

Expand Down

0 comments on commit 307cc4f

Please sign in to comment.