Closed ghost closed 5 years ago
@Salmanah Please either share the above files as GitHub gists, or properly format them with the triple backtick notation so it's more readable.
@Salmanah Please either share the above files as GitHub gists, or properly format them with the triple backtick notation so it's more readable.
My aplogies, I have fixed it now.
@Salmanah Hmm, can you check the local Caliper logs (in the log/
dir if you didn't change it)? From Caliper's POV, the benchmark is run successfully. You should also add some logging to your logic.js to see what happens inside.
@aklenik I checked the local Caliper logs and added some lines where I could see that my participants were created and if the transaction is called. Everything seems to be fine, but I noticed when I wrote a console.log in my logic.js nothing seems to be printed out, I do not think that the transaction is being called. What could be the reason for that?
@aklenik I just recently found a new error from one of the peer containers. This error is just running on my chaincode, which I think is weird. The other sample chaincodes do no generate an error when run under the same environment.
@nklincoln Any pointers about how to activate the identity for a custom example?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi every one I have the same problem. when my code send data to registry, all of the that be failed . can you help me(url).
Context
I have created a test environment locally and now I am trying to test my transactions, the issue here is that all my tests fail. I do not know why, as when I use any of the other test folders like perishable-network or vehicle-lifecycle-network, with my fabric network some of the tests succeed.
This is the output of me running my own tests on the files below, I want to know why they fail and how i can possibly fix the issues:
Expected Behavior
Expecting some of the test iterations to succeed
Actual Behavior
Every test iteration fails
Possible Fix
Steps to Reproduce
/* A participant of type Owner in the network */ participant Owner identified by personId{ o String personId o String firstname optional o String lastname optional }
/* An asset of type Device in the network */ participant Device identified by deviceId{ o String deviceId --> Home home o String deviceLocation o Double minimumTemperature o Double maximumTemperature o String nickname o DeviceReading[] deviceReadings optional }
abstract transaction DeviceTransaction{ --> Device device }
concept Address{ o String street o String city }
transaction DeviceReading extends DeviceTransaction{ o Double temperature o String readingTime o String readingDate }
transaction AddingHome{ --> Home home }
transaction AddDevice extends DeviceTransaction{ }
event HomeAdded{ --> Owner homeOwner --> Home home o String message }
event DeviceAdded{ --> Device device o String message }
event DeviceReadingSent{ o String message --> Device device }
event TemperatureThresholdEvent{ o String message o Double temperature o String readingTime }
transaction SetupDemo{
}
'use strict';
/***
@transaction */
async function readingReceived(readings){ const device = readings.device; const readingTime = readings.readingTime; const factory = getFactory();
console.log("Temperature received at: "+readingTime); console.log("From Device: "+device.deviceId);
if(device.deviceReadings){ device.deviceReadings.push(readings); }else{ device.deviceReadings = [readings]; }
if(readings.temperature < device.minimumTemperature || readings.temperature > device.maximumTemperature){ var temperatureEvent = factory.newEvent("org.blockchain.model","TemperatureThresholdEvent"); temperatureEvent.device = device; temperatureEvent.message = "Temperature has reached threshold! "+device.deviceId+" has a temperature of "+readings.temperature; temperatureEvent.readingTime = reading.readingTime; emit(temperatureEvent); } //add the temperature reading to the device const deviceRegistry = await getParticipantRegistry('org.blockchain.model.Device'); await deviceRegistry.update(device); }
'use strict';
const removeExisting = require('../composer-test-utils').clearAll; const logger = require('../../../src/comm/util').getLogger('smarthomes.js'); const os = require('os'); const uuid = os.hostname() + process.pid; // UUID for client within test
module.exports.info = 'Smarthomes Network Performance Test';
let bc; let busNetConnection; let testAssetNum; let factory; let assetId; let testTransaction; const namespace = 'org.blockchain.model';
module.exports.init = async function(blockchain, context, args) { // Create Participants and Assets to use in main test bc = blockchain; busNetConnection = context; testAssetNum = args.testAssets; testTransaction = args.transaction; assetId = 0;
};
module.exports.run = function() { let transaction; switch(testTransaction){ case 'DeviceReading': { transaction = factory.newTransaction(namespace, 'DeviceReading'); transaction.device = factory.newRelationship(namespace, 'Device', 'DEVICE' + uuid + '' + assetId++); transaction.temperature = 40.0; let now = new Date(); now.setDate(now.getDate()); transaction.readingDate = now; transaction.readingTime = "12:00"; break; } case 'addingHome': { transaction = factory.newTransaction(namespace, 'AddingHome'); transaction.home = factory.newRelationship(namespace, 'Home', 'HOME'+uuid+''); break; } default: { throw new Error("No valid test transaction specified in module.run"); } }
};
module.exports.end = function() { return Promise.resolve(true); };