Skip to content

Commit

Permalink
Add a test for a full JSON file.
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Promislow <epromislow@suse.com>
  • Loading branch information
ericpromislow committed Jun 20, 2023
1 parent d37bcff commit 507c182
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions src/go/rdctl/pkg/reg/reg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,107 @@ func TestJsonToRegFormat(t *testing.T) {
sort.Strings(receivedMapValues)
assert.Equal(t, expectedMapValues, receivedMapValues)
})
t.Run("Handles a full settings file", func(t *testing.T) {
jsonBody := `{
"version": 8,
"application": {
"adminAccess": false,
"debug": true,
"extensions": {
"allowed": {
"enabled": false,
"list": ["found", "fully", "bawdy", "tarot"]
}
},
"pathManagementStrategy": "manual",
"telemetry": {
"enabled": true
},
"updater": {
"enabled": false
},
"autoStart": false,
"startInBackground": false,
"hideNotificationIcon": false,
"window": {
"quitOnClose": false
}
},
"containerEngine": {
"allowedImages": {
"enabled": false,
"patterns": ["fable", "there", "crazy", "whine"]
},
"name": "moby"
},
"virtualMachine": {
"memoryInGB": 4,
"numberCPUs": 2,
"hostResolver": true
},
"WSL": {
"integrations": {
"butte" : true, "assay": false, "moron": 55, "hovel":"stuffo"
}
},
"kubernetes": {
"version": "1.25.9",
"port": 6443,
"enabled": true,
"options": {
"traefik": true,
"flannel": true
},
"ingress": {
"localhostOnly": false
}
},
"portForwarding": {
"includeKubernetesServices": false
},
"images": {
"showAll": true,
"namespace": "k8s.io"
},
"diagnostics": {
"showMuted": false,
"mutedChecks": {
"check1": true,
"check2": false
}
},
"extensions": {
"extcheck1": true,
"extcheck2": false
},
"experimental": {
"virtualMachine": {
"type": "qemu",
"useRosetta": false,
"socketVMNet": false,
"mount": {
"type": "reverse-sshfs",
"9p": {
"securityModel": "none",
"protocolVersion": "9p2000.L",
"msizeInKib": 128,
"cacheMode": "mmap"
}
},
"networkingTunnel": false,
"proxy": {
"enabled": false,
"address": "",
"password": "",
"port": 3128,
"username": ""
}
}
}
}
`
lines, err := JsonToReg("hkcu", "defaults", jsonBody)
assert.NoError(t, err)
assert.Equal(t, 105, len(lines))
})
}

0 comments on commit 507c182

Please sign in to comment.