NetApp / netappdvp

A Docker volume plugin for NetApp storage
96 stars 33 forks source link

storage_drivers/ontap_test.go is failing #35

Closed dccurtis closed 7 years ago

dccurtis commented 7 years ago

onto_test.go is failing due to a "json: error calling MarshalJSON for type json.RawMessage: unexpected end of JSON input" error in encodeConfig

i.e:

    configMissingStorageDriverName := &CommonStorageDriverConfig{
            Version:           1,
            StorageDriverName: "", // emtpy on purpose
            Debug:             false,
            DisableDelete:     false,
    }

The missing members are StoragePrefixRaw and SnapshotPrefixRaw. I have a fix for this by adding the missing members. I'm still working to understand specifically why this is causing the failure.

I have a few questions related to this:

  1. Should ValidateCommonSettings also verify StoragePrefixRaw and SnapshotPrefixRaw since they are part of the CommonStorageDriverConfig struct?
  2. Can someone show me an example of what these fields would typically look like when being supplied in the configFile?

Test Failure:

Dougs-MacBook-Air:storage_drivers doug$ go test DEBU[0000] Running storage_drivers.TestOntap_ValidateCommonSettings... --- FAIL: TestOntap_ValidateCommonSettings (0.00s) ontap_test.go:43: Did not validate storage driver name ontap_test.go:57: Did not validate version number ontap_test.go:71: Expected to have a good config object, unexpected error: Cannot decode json configuration error: unexpected end of JSON input DEBU[0000] Running storage_drivers.TestOntapNas_Init... DEBU[0000] OntapNASStorageDriver#Name()
DEBU[0000] Running storage_drivers.TestOntapNas_Initialize... DEBU[0000] OntapNASStorageDriver#Initialize(...)
DEBU[0000] Running storage_drivers.TestOntapSan_Init... DEBU[0000] Running storage_drivers.TestOntapSan_Initialize... DEBU[0000] OntapSANStorageDriver#Initialize(...)
DEBU[0000] Running TestStorageDrivers...
FAIL exit status 1

ntap-rippy commented 7 years ago

A1) It would be nice to test all 3 states:

  1. No prefix entry specified at all (should get the default prefix per storage driver). Golang itself doesn't support null strings which is why we have this Raw datatype handling.
  2. Explicitly set to empty: "storagePrefix": ""
  3. Set to a non-default value: "storagePrefix": "rippy_"

A2) Here's some examples: Without a prefix; ontap prefix default of netappdvp_ should be used

{
    "version": 1,
    "storageDriverName": "ontap-nas",
    "managementLIF": "10.0.207.6",
    "dataLIF": "10.0.207.5",
    "svm": "nfs_vs",
    "username": "vsadmin",
    "password": "Cei1sha8ipeo",
    "aggregate": "aggr1"
}

With an empty prefix (last line); no prefix should be used

{
    "version": 1,
    "storageDriverName": "ontap-san",
    "managementLIF": "10.0.207.8",
    "svm": "iscsi_vs",
    "username": "vsadmin",
    "password": "Tho5Aghai5th",
    "aggregate": "aggr1",
    "storagePrefix": ""
}

With a non-default prefix (last line)

{
    "version": 1,
    "storageDriverName": "ontap-san",
    "managementLIF": "10.0.207.8",
    "dataLIF": "10.0.207.7",
    "svm": "iscsi_vs",
    "username": "vsadmin",
    "password": "Tho5Aghai5th",
    "aggregate": "aggr1",
    "storagePrefix": "rippy_"
}
dccurtis commented 7 years ago

Thanks! I'll add these test cases when I submit the fix for this.

Has there been any discussion of integrating the repo with Travis-CI or something similar?

dccurtis commented 7 years ago

Thi issue can be closed