// CleanupUserData removes user data.
CleanupUserData removes user data.
// CleanupUserData removes user data .
func CleanupUserData(sdk *fabsdk.FabricSDK) {
	var keyStorePath, credentialStorePath string
	configBackend, err := sdk.Config()
	if err != nil {
		keyStorePath = "/tmp/sys-6g1p1-store"
		credentialStorePath = "/tmp/sys-6g1p1-msp"
		fmt.Println("Cleaning up if directory keyStorePath:%s, credentialStorePath:%s", keyStorePath,credentialStorePath)
	} else {
		cryptoSuiteConfig := cryptosuite.ConfigFromBackend(configBackend)
		identityConfig, err := identityconfigmsp.ConfigFromBackend(configBackend)
		if err != nil {
			fmt.Println("CleanupUserData removes user data fail:%s", err)
		}
		keyStorePath = cryptoSuiteConfig.KeyStorePath()
		credentialStorePath = identityConfig.CredentialStorePath()
		fmt.Println("Cleaning up else directory keyStorePath:%s, credentialStorePath:%s", keyStorePath,credentialStorePath)
	}
	CleanupTestPath(keyStorePath)
	CleanupTestPath(credentialStorePath)
}
func CleanupUserData ( sdk * fabsdk . FabricSDK ) { var keyStorePath , credentialStorePath string configBackend , err := sdk . Config ( ) if err != nil { keyStorePath = " " credentialStorePath = " " fmt . Println ( " " , keyStorePath , credentialStorePath ) } else { cryptoSuiteConfig := cryptosuite . ConfigFromBackend ( configBackend ) identityConfig , err := identityconfigmsp . ConfigFromBackend ( configBackend ) if err != nil { fmt . Println ( " " , err ) } keyStorePath = cryptoSuiteConfig . KeyStorePath ( ) credentialStorePath = identityConfig . CredentialStorePath ( ) fmt . Println ( " " , keyStorePath , credentialStorePath ) } CleanupTestPath ( keyStorePath ) CleanupTestPath ( credentialStorePath ) }
CleanupUserData removes user data.
CleanupUserData removes user data .
// if an error is returned from Config, it means configBackend was nil, in this case simply hard code // the keyStorePath and credentialStorePath to the default values // This case is mostly happening due to configless test that is not passing a ConfigProvider to the SDK // which makes configBackend = nil. // Since configless test uses the same config values as the default ones (config_test.yaml), it's safe to // hard code these paths here //t.Fatal(err)