Gatling senario is
val scn = scenario("First Test Scenario").exec( Login.login )
setUp(
scn.inject(constantUsersPerSec(100) during(20 seconds) )
.protocols(httpConf)
)
object Login{
val login = exec(http("Login")
.get("/auth/login")
)
}
It give me that error message:
21:24:23.863 [WARN ] i.g.h.a.ResponseProcessor - Request 'Login' failed: j.n.ConnectException: Failed to open a socket. what does that mean?
Related
Why am I getting the following error when trying to create a metadata account using createCreateMetadataAccountV2Instruction from the #metaplex-foundation/mpl-token-metadata library?
SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Program failed to complete
at Connection.sendEncodedTransaction (C:\xampp\htdocs\sol-tools\node_modules\#solana\web3.js\src\connection.ts:4464:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Connection.sendRawTransaction (C:\xampp\htdocs\sol-tools\node_modules\#solana\web3.js\src\connection.ts:4423:20)
at async Connection.sendTransaction (C:\xampp\htdocs\sol-tools\node_modules\#solana\web3.js\src\connection.ts:4411:12)
at async sendAndConfirmTransaction (C:\xampp\htdocs\sol-tools\node_modules\#solana\web3.js\src\util\send-and-confirm-transaction.ts:31:21)
at async addMetadataToToken (C:\xampp\htdocs\sol-tools\src\lib\metadata.ts:86:16)
at async Command.<anonymous> (C:\xampp\htdocs\sol-tools\src\cli.ts:48:7) {
logs: [
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s invoke [1]',
'Program log: Instruction: Create Metadata Accounts v2',
"Program log: panicked at 'range end index 36 out of range for slice of length 0', program/src/utils.rs:231:27",
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s consumed 6223 of 1400000 compute units',
'Program failed to complete: BPF program panicked',
'Program metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s failed: Program failed to complete'
]
}
Here's my code:
import {
createCreateMetadataAccountV2Instruction,
PROGRAM_ID,
} from '#metaplex-foundation/mpl-token-metadata'
import {
Connection,
Keypair,
PublicKey,
sendAndConfirmTransaction,
Transaction,
} from '#solana/web3.js'
export const addMetadataToToken = async (
connection: Connection,
tokenMint: PublicKey,
tokenOwner: Keypair,
name: string,
symbol: string,
arweaveLink: string
) => {
const seed1 = Buffer.from('metadata', 'utf8')
const seed2 = PROGRAM_ID.toBuffer()
const seed3 = tokenMint.toBuffer()
const [metadataPDA, _bump] = PublicKey.findProgramAddressSync(
[seed1, seed2, seed3],
PROGRAM_ID
)
const accounts = {
metadata: metadataPDA,
mint: tokenMint,
mintAuthority: tokenOwner.publicKey,
payer: tokenOwner.publicKey,
updateAuthority: tokenOwner.publicKey,
}
const dataV2 = {
name,
symbol,
uri: arweaveLink,
// we don't need these
sellerFeeBasisPoints: 0,
creators: null,
collection: null,
uses: null,
}
const args = {
createMetadataAccountArgsV2: {
data: dataV2,
isMutable: true,
},
}
const ix = createCreateMetadataAccountV2Instruction(accounts, args)
const tx = new Transaction()
tx.add(ix)
const txid = await sendAndConfirmTransaction(connection, tx, [tokenOwner])
console.log(txid)
}
Turns out I was on trying to create metadata for a token on devnet, but was using a mainnet-beta rpc endpoint for the Connection class. Thus the token I was trying to create metadata for didn't exist.
This is a really Common Error Message that occurs when there is some issue with what you are passing to the program. So make sure everything that you are input to the program is correct. In 90% of the cases, it gets resolved when checking the inputs correctly.
I am new to the block chain. Trying to run the calliper on my chaincode, in the the test network and getting the following errors. Not sure what I need to do here, to get the arguments be passed successfully to the chaincode.
Calliper command I used:
npx caliper launch manager --caliper-workspace ./ --caliper-networkconfig networks/networkConfig.yaml --caliper-benchconfig benchmarks/myPolicyBenchmark.yaml --caliper-flow-only-test --caliper-fabric-gateway-enabled
My Workload
'use strict';
const { WorkloadModuleBase } = require('#hyperledger/caliper-core');
class MyWorkload extends WorkloadModuleBase {
constructor() {
super();
}
async initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext) {
await super.initializeWorkloadModule(workerIndex, totalWorkers, roundIndex, roundArguments, sutAdapter, sutContext);
for ( let i=0; i<this.roundArguments.policies; i++) {
const policyID = `${this.workerIndex}_${i}`;
console.log(`Worker ${this.workerIndex}: Creating policy ${policyID}`);
const request = {
contractId: this.roundArguments.contractId,
contractFunction: 'CreatePolicy',
invokerIdentity: 'Admin',
contractAtguments: [policyID,"Test Policy 2","This is a test policy", "PUBLIC","PUBLIC","[\"READ\"]", "ABC", "abc#gmail.com", "[\"NONE\"]", "{}"],
readOnly: false
};
await this.sutAdapter.sendRequests(request);
}
}
async submitTransaction() {
const randomId = Math.floor(Math.random()*this.roundArguments.policies);
const myArgs = {
contractId: this.roundArguments.contractId,
contractFunction: 'ReadPolicy',
invokerIdentify: 'Admin',
//contractArguments: [`${this.workerIndex}_${randomId}`],
contractArguments: ['3'],
readOnly: true
};
await this.sutAdapter.sendRequests(myArgs);
}
async cleanupWorkloadModule() {
for (let i=0; i<this.roundArguments.policies; i++){
const policyID = `${this.workerIndex}_${i}`;
console.log(`Worker ${this.workerIndex}: Deleting policy ${policyID}`);
const request = {
contractId: this.roundArguments.contractId,
contractFunction: 'DeletePolicy',
invokerIdentity: 'Admin',
contractAtguments: [policyID],
readOnly: false
};
await this.sutAdapter.sendRequests(request);
}
}
}
function createWorkloadModule() {
return new MyWorkload();
}
module.exports.createWorkloadModule = createWorkloadModule;
The error I get is
2022.06.14-00:46:51.063 info [caliper] [caliper-worker] Info: worker 0 prepare test phase for round 0 is starting...
Worker 0: Creating policy 0_0
2022.06.14-00:46:51.078 info [caliper] [caliper-worker] Info: worker 1 prepare test phase for round 0 is starting...
Worker 1: Creating policy 1_0
2022-06-14T06:46:51.130Z - error: [Transaction]: Error: No valid responses from any peers. Errors:
peer=peer0.org2.example.com:9051, status=500, message=error in simulation: transaction returned with failure: Error: Expected 10 parameters, but 0 have been supplied
peer=peer0.org1.example.com:7051, status=500, message=error in simulation: transaction returned with failure: Error: Expected 10 parameters, but 0 have been supplied
2022.06.14-00:46:51.132 error [caliper] [connectors/v2/FabricGateway] Failed to perform submit transaction [CreatePolicy] using arguments [], with error: Error: No valid responses from any peers. Errors:
peer=peer0.org2.example.com:9051, status=500, message=error in simulation: transaction returned with failure: Error: Expected 10 parameters, but 0 have been supplied
peer=peer0.org1.example.com:7051, status=500, message=error in simulation: transaction returned with failure: Error: Expected 10 parameters, but 0 have been supplied
at newEndorsementError (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/fabric-network/lib/transaction.js:49:12)
at getResponsePayload (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/fabric-network/lib/transaction.js:17:23)
at Transaction.submit (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/fabric-network/lib/transaction.js:212:28)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async V2FabricGateway._submitOrEvaluateTransaction (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/#hyperledger/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:376:26)
at async V2FabricGateway._sendSingleRequest (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/#hyperledger/caliper-fabric/lib/connector-versions/v2/FabricGateway.js:170:16)
at async V2FabricGateway.sendRequests (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/#hyperledger/caliper-core/lib/common/core/connector-base.js:78:28)
at async MyWorkload.initializeWorkloadModule (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/workload/readPolicy.js:25:13)
at async CaliperWorker.prepareTest (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/#hyperledger/caliper-core/lib/worker/caliper-worker.js:160:13)
at async WorkerMessageHandler._handlePrepareMessage (/Users/sam/my_thesis/Project/changetracker/caliper-workspace/node_modules/#hyperledger/caliper-core/lib/worker/worker-message-handler.js:210:13)
The same inputs works fine with running through the peer
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile "${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C mychannel -n policylist --peerAddresses localhost:7051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles "${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c '{"function":"CreatePolicy","Args":["4","Test Policy 2","This is a test policy", "PUBLIC","PUBLIC","[\"READ\"]", "ABC", "abc#gmail.com", "[\"NONE\"]", "{}" ]}'
2022-06-14 00:58:06.489 CST 0001 INFO [chaincodeCmd] chaincodeInvokeOrQuery -> Chaincode invoke successful. result: status:200 payload:"{\"PolicyId\":\"4\",\"docType\":\"PolicyDoc\",\"PolicyName\":\"Test Policy 2\",\"PolicyDescription\":\"This is a test policy\",\"PolicyDataClassification\":\"PUBLIC\",\"PolicyAccessCategory\":\"PUBLIC\",\"PolicyAccessMethod\":[\"READ\"],\"PolicyOwner\":\"ABC\",\"PolicyApprovalStatus\":\"NEW\",\"PolicyCreatedOn\":\"Tue, 14 Jun 2022 06:58:06 GMT\",\"PolicyContactEmail\":\"abc#gmail.com\",\"PolicyRestrictions\":\"[\\\"NONE\\\"]\",\"PolicyMiscellaneous\":{}}"
Karate afterFeature function execution works fine when run locally but fails when run through Jenkins, I get assertion failed: assert evaluated to false: responseStatus == 200 || responseStatus == 404. Whereas the responseStatus should either be 200 or 404.
Code Snippet
main.feature snippet
Background:
...
* def myName1 = 'karate-test-name'
* configure afterFeature = function(){ karate.call('cleanup.feature'); }
...
...
cleanup.feature
#ignore
Feature: To cleanup after main.feature execution. This Feature is not supposed to be run individually.
Background:
* url myUrl
Scenario: Delete
* print 'In "cleanup.feature", If exists delete: ' + myName1
Given path 'v1/myapi/',myName1,''
And header Content-Type = 'application/json; charset=utf-8'
And request {}
When method delete
Then assert responseStatus == 200 || responseStatus == 404
Logs from Jenkins:
The assertion for the responseStatus fails, but it does not log the actual value of the responseStatus.
23:03:15.448 [pool-1-thread-4] ERROR com.intuit.karate - assertion failed: assert evaluated to false: responseStatus == 200 || responseStatus == 404
23:03:15.450 [pool-1-thread-4] ERROR com.intuit.karate - feature call failed: cleanup.feature
arg: null
cleanup.feature:16 - assert evaluated to false: responseStatus == 200 || responseStatus == 404
23:03:15.451 [pool-1-thread-4] ERROR com.intuit.karate - javascript function call failed:
cleanup.feature:16 - assert evaluated to false: responseStatus == 200 || responseStatus == 404
23:03:15.451 [pool-1-thread-4] ERROR com.intuit.karate - failed function body: function(){ karate.call('cleanup.feature'); }
Moreover, I do not see the logs for execution of afterFeature in Jenkins, neither it is part of the Cucumber report for me to do further analysis.
Most likely an old version of Karate. Try 0.9.5
If you still can't solve this - please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue
And also, please read this for other options: https://stackoverflow.com/a/60944060/143475
I have the following code that runs without any issues in Chrome & Firefox, but will not run in Edge.
Error that comes up:
Unable to connect to Room: Media connection failed
Can you please verify and confirm why it isn't working:
let connectOptions = {
name: roomIdentity,
tracks: [localAudioTrack, localVideoTrack]
}
console.log(connectOptions)
//creating stream for agent
if (this.context.agent) {
TwilioVideo.connect(twilioToken, connectOptions)
.then(room => {
//attach error handler to room object
room.on('disconnected', (room, error) => {})
}, error => {
console.error('Unable to connect to Room: ' + error.message)
})
Edit 1:
Fill error output:
code: 53405
description: "Media connection failed"
message: "Media connection failed"
name: "TwilioError"
stack: "TwilioError: Media connection failed at _getOrCreate (http://localhost:64000/static/js/1.chunk.js:322197:11) at Anonymous function (http://localhost:64000/static/js/1.chunk.js:322274:9) at Anonymous function (http://localhost:64000/static/js/1.chunk.js:97029:13) at flush (http://localhost:64000/static/js/1.chunk.js:91027:9)"
I am always getting the "Error Connecting to ${url}" message?
Can anyone please show me my mistake?
def url = new URL("https://www.google.com")
HttpURLConnection connection = (HttpURLConnection) url.openConnection()
connection.setRequestMethod("GET")
// connection.setConnectTimeout(10000)
connection.connect()
if (connection.responseCode == 200 || connection.responseCode == 201) {
def returnMessage = connection.content
//print out the full response
println returnMessage
} else {
println "Error Connecting to " + url
}
| Error 2012-07-05 00:04:05,950 [http-bio-8080-exec-6] ERROR errors.GrailsExceptionResolver - ConnectException occurred when processing request: [GET] /CopperApplications/urlTracker Connection timed out: connect. Stacktrace follows: Message: Connection timed out: connec
Your code seems correct, and produces the expected(?) results on Groovy 1.7.9 with 1.6.0_33 JVM. There is likely something amiss with your network (as indicated by the connection timeout error).