I plan to iterate around many attributes of the $dut model and various test conditions in my test program. I was testing out a very simple flow and am getting an error regarding duplicate test IDs.
Flow.create do |options|
[:pmin, :pmax].each do |cond|
bist :mbist, ip: :cpu, testmode: :hr, cond: cond, id: :hr
end
end
Here is the error:
[ERROR] 64.198[0.193] || Test ID hr_965EA18 is defined more than once in flow ws1:
[ERROR] 64.199[0.001] || /users/user/origen/ppekit/program/components/_bist.rb:4
[ERROR] 64.199[0.000] || /users/user/origen/ppekit/program/components/_bist.rb:4
I guess I would expect this to work but when I checked out the test program generator docs I didn't see an example of loops, only conditionals. I do see the concept of re-useable flow snippets but that seems to work best for a repeatable sequence of tests, versus just iterating ad-hoc.
regards
Your code expands to this:
bist :mbist, ip: :cpu, testmode: :hr, cond: :pmin, id: :hr
bist :mbist, ip: :cpu, testmode: :hr, cond: :pmax, id: :hr
Which means you have two tests with the ID :hr, which is not allowed as IDs must be unique.
Either consider if you really need the ID, you probably don't unless you are referring to this test in a conditional execution relationship with another test, or else update your code to generate unique IDs:
[:pmin, :pmax].each do |cond|
bist :mbist, ip: :cpu, testmode: :hr, cond: cond, id: "hr_#{cond}"
end
Related
I have been using Meilisearch for a couple of months and have recently upgraded to 0.26.0. For some reason, when I am today trying to create an index using the node package, nothing seems to happen.
I can successfully use the createIndex method like below:
client.createIndex("movies")
and the return value for the method shows the task:
{
uid: 26858,
indexUid: 'movies',
status: 'enqueued',
type: 'indexCreation',
enqueuedAt: '2022-04-08T15:15:06.325108519Z'
}
However, when I look up this task it seems that it has not been started:
{
uid: 26858,
indexUid: 'movies',
status: 'enqueued',
type: 'indexCreation',
details: { primaryKey: null },
duration: null,
enqueuedAt: '2022-04-08T15:15:06.325108519Z',
startedAt: null,
finishedAt: null
}
And indeed I can't find the index using the getIndexes method.
Strangely I created an index without issue just a few days ago.
Any idea what the issue might be or how I could debug this?
Most of Meilisearch's asynchronous operations belong to a category called "tasks". Create an index is one of them.
Depending on the queue size and server processing power it may take a while to process recently created tasks.
You can find more information on section asynchronous operation of documentation.
I'm trying to use the Puppet 4.4 AST to query a custom fact using the inventory API. The structure of the fact I'm querying is
apps: [
{
name: 'test-app-1',
version: '1'
},
{
name: 'test-app-2',
version: '5'
}
...
]
I'm looking to return all nodes that contain a hash of app['name'] == 'test-app-1'. This is close to returning what I'm looking for:
["=", "facts.apps[1].name", "test-app-2"]
but I don't know which element index the app will be at, so I need something more like this (incorrect) syntax:
["=", "facts.apps[*].name", "test-app-2"]
I figured this out using the match notation.
["=", "facts.apps.match(\".*\").name", "test-app-2"]
My question is related to this
findAndModify Error in mongodb - nodejs - error code 17287
But the solution hasn't worked (i tried specify the order but i get the same error) I think it might be something along the lines of the index I am using example instead of _id (_id is a field in this collection I just don't want to search by _id in this case) not sure at all...
The Error:
{ [MongoError: exception: nextSafe(): { $err: "Can't canonicalize query: BadValue bad sort specification", code: 17287 }]
name: 'MongoError',
message: 'exception: nextSafe(): { $err: "Can\'t canonicalize query: BadValue bad sort specification", code: 17287 }',
errmsg: 'exception: nextSafe(): { $err: "Can\'t canonicalize query: BadValue bad sort specification", code: 17287 }',
code: 13106,
ok: 0 }
This is my code, it should find and modify (and return using new:true) the first instance of a document that has the field example equal to minus one.
db.collection('documents').findAndModify({example:-1},{$set:{example:0}},{new:true},function(err,result){
console.dir(err||result);
});
But all it does is error like it hates my face!
Here is a document:
{'_id':0,'example':-1}
My id field is custom numerical Where I ensure the _id is always unique (For my purposes I cannot change the _id to standard mongodb way.)
It was painful to get this to work as the node docs end abruptly and then you are left guessing on how the code structure should be on what would/could of just been a standard structure but isn't! I have wasted a day thanks to the devs undocumented methods.
Here is the working code
db.collection('documents').findAndModify({'example':{$eq:-1}},[['example',1]],{$set:{'example':-1}},{'new':true},function(err,result){
console.dir(err||result);
});
I am not sure I really like writing code like this ether. I might look for another node module for this as the query above looks disgusting!
Would be greate if I could find something that looks as simple as this:
db.collection('documents').findModifyReturn('find:example==-1;order:asc;set:example=0;',function(e,r){});
Try using the $eq operator.
db.collection('documents').findAndModify({example: {$eq: -1}}, {'example', 'ascending'},{$set:{example:0}},{new:true},function(err,result){
console.dir(err||result);
});
Looking for some input on the following. Hopefully this isn't too subjective for the moderators.
Just started playing with deployd.com BaaS API and have the following scenario.
If an mobile app was to have a Group object and a User, where a User could belong to many Groups and Groups have many Users (many-to-many relationship) I could design this several ways with two that I'm considering:
A)
Users [{
id: 1,
groups : {1,2,3,4}
}]
Groups [{
id: 1,
users : {1,2,3,4}
}]
And
B)
Users [{
id: 1
}]
Groups [{
id: 1
}]
UserGroups [{
id: 1,
group: 1,
user: 1,
},{
id: 2
group: 1,
user: 2,
}]
I'm leaning towards B as I can store meta-data (date a user joined the group, etc) but this seems to be more a RDBMS method and I'm wondering if I will lose any of the benefits of NoSQL by trying to create such relations.
Hypothetically speaking this mobile app would be used by thousands of mobile users simultaneously and hence choosing NoSQL versus RDBMS in the first place.
B) is not a good idea. MongoDB doesn't do joins, so any operation which needs multiple collections means multiple subsequent queries, which is much slower than a database-internal JOIN in a relational database. That means you should store relations in the documents themself.
When you want to store meta-information, keep in mind that arrays can't just store primitive values. They can also store objects. Example:
{
id:1,
name:"Bob",
groups: [
{ name: "nice people",
position: "member",
joined: ISODate(2013, 12, 3)
} ,
{ name: "evil people",
position: "admin",
joined: ISODate(2012, 11, 22)
}
]
}
It might be a good idea to store enough meta-information so that many common queries can be fulfilled without querying the referenced objects. When you want to show a list of groups when someone looks up a users profile, and you store all the group information you need in that overview in the users-document, you avoid having to do a second query to retrieve the group-documents.
I'm using node.js and the api key for auth. All my get actions work, and I've been able to post a new project, but new tasks always return 'server error'. Here's the object I'm sending to the /tasks endpoint:
data: {
name: 'Figure this out',
notes: '',
assignee: null,
completed: false,
assignee_status: 'later',
completed_at: null,
due_on: null,
tags: [],
parent: null,
followers: [ { id: 5622986387066 }, { id: 5622895459066 } ],
projects: [ 6156399090409 ],
workspace: 1707039411020
}
Any ideas? I've tried passing those ID values a variety of ways, and I've tried creating a more simple task, always fails with a 'server error' response.
Seems like it's the "parent": null that's causing the unhelpful Server Error, which definitely seems like a bug on our side - I've filed it and will hopefully get time to look into it soon. Trim that out, and it gives you actual error messages.
Just to save you some time: you can't set completed_at or tags, and followers should be just an array of integers ("followers": [ 5622986387066, 5622895459066 ]).
You can set completed: [true/false], and the completed_at will be set to the time at which it was marked complete. Not being able to attach tags to a task is a known issue, and one we're hoping to rectify.
Additionally, it's just a little annoying that the format of a response doesn't map 1-1 to the format for posting/updating. We're hoping to do a pass on the overall design of the API to unify those parts a bit more.