Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing the operator $where with aggregation pipeline #4148

Closed
1 of 3 tasks
anupamme opened this issue Jun 3, 2022 · 29 comments
Closed
1 of 3 tasks

Replacing the operator $where with aggregation pipeline #4148

anupamme opened this issue Jun 3, 2022 · 29 comments
Labels
Milestone

Comments

@anupamme
Copy link
Contributor

anupamme commented Jun 3, 2022

Is your feature request related to a problem / use case? Please describe.
I'm part of Azure Cosmos DB team and we are working to make our Mongo API work with Fiware-Orion without any issues. One of these issues is: the use of Mongo DB operator $where [1] in the codebase [2]. Since $where has been deprecated by Mongo DB and would not be supported in future releases (it is presently supported though), we recommend to replace $where with the aggregation pipeline [3].

  1. https://www.mongodb.com/docs/manual/reference/operator/query/where/
  2. static void fill_idPtypeNP
  3. https://www.mongodb.com/docs/manual/core/aggregation-pipeline/

Describe the solution you'd like
We recommend moving away from $where operator and use aggregation pipeline instead. The codebase at [2] to be replaced with using aggregation pipeline.

Describe alternatives you've considered
$where is a deprecated feature in MongoDB so considering an alternate is going to be a lot more work as we will supporting a deprecated feature in the future. So we did not consider any other alternative.

Describe why you need this feature

  • To be able to offer Azure Cosmos DB API as an fully-functional option to the users of Fiware-Orion.
  • Customers of Fiware-Orion are coming to us saying that Cosmos DB Mongo API does not support $where operator. We would like to resolve this issue.

Additional information
Add any other information, diagrams or screenshots about the feature request here.

Do you have the intention to implement the solution

  • Yes, I have the knowledge to implement this new feature.
  • Yes, but I will need help.
  • No, I do not have the skills.
@fgalan
Copy link
Member

fgalan commented Jun 3, 2022

Thank you very much for your feedback! We started to use $where operation in a far away past (when MongoDB 2.4/2.6 was the newest MongoDB version :) and it was not possible to solve the problem with the aggregation pipeline stages at that moment. Now the proper aggregation stages exists for that, so I think is a good idea what you propose.

Please, go ahead with the pull request fixing this. I can provide some degree of support (best effort mode) if you need it.

By the way, your issue report is pretty comprehensive. However, it would be great if you could cite (from MongoDB official documentation) the place in which they say $where operator is deprecated.

@anupamme
Copy link
Contributor Author

Here are some of the links which mention that $where is either deprecated, not usable or poses security threat:

  1. "Starting in MongoDB 4.4, $where no longer supports the deprecated BSON type JavaScript code with scope (BSON type 15). The $where operator only supports BSON type String (BSON type 2) or BSON type JavaScript (BSON type 13). The use of BSON type JavaScript with scope for $where has been deprecated since MongoDB 4.2.1"

  2. Javascript is not enabled in some of the Atlas instances e.g. M0 free clusters and M2/M5 shared clusters do not support server-side JavaScript.

EXAMPLE

$where and map-reduce are not supported.

  1. For security reasons users prefer to disable Javascript (server side scripting), also recommended by MongoDB (https://www.mongodb.com/docs/manual/reference/operator/query/where/#javascript-enablement)

In contrast, aggregation pipeline is supported in all instances, has no security issues in using it and also is not deprecated. Hope this answers your query.

@nsrivastava9
Copy link

Hi @fgalan , Can you please provide the sample document /document structure and the query that is being executed to fetch the document as per fiware-orion/src/lib/mongoBackend/MongoCommonUpdate.cpp

@anupamme
Copy link
Contributor Author

Hello @fgalan

Reaching out as we (@nsrivastava9 and I) need some high level guidance for making this change.

What we want to do is replace $where with aggregation pipeline [https://www.mongodb.com/docs/manual/core/aggregation-pipeline/]

So effectively we would like to make $where an alias for aggregation pipeline, meaning whenever the user calls @where we end up calling command aggregate with appropriate arguments.

In code we are looking into MongoCommonUpdate.cpp [https://github.com/telefonicaid/fiware-orion/blob/e1b079c8843a759b3d53d458eb2034dc8a9793e3/src/lib/mongoBackend/MongoCommonUpdate.cpp#L1257]

But could you give some guidance in terms what changes in the code need to be made for this?

@fgalan
Copy link
Member

fgalan commented Aug 5, 2022

Hi @fgalan , Can you please provide the sample document /document structure and the query that is being executed to fetch the document as per fiware-orion/src/lib/mongoBackend/MongoCommonUpdate.cpp

For Orion logs (contextBroker -fg -logLevel DEBUG -t 100 -noCache -logForHumans) I think this is the query you are asking for:

DEBUG@2022-08-05T10:56:17.271Z  MongoCommonUpdate.cpp[1538]: query() in 'orion.csubs' collection: '{ "$or" : [ { "entities.id" : "Room1", "$or" : [ { "entities.type" : "Room" }, { "entities.type" : { "$exists" : false } } ], "entities.isPattern" : "false", "entities.isTypePattern" : { "$ne" : true }, "expiration" : { "$gt" : 1659696977 }, "status" : { "$ne" : "inactive" } }, { "entities.isPattern" : "true", "entities.isTypePattern" : { "$ne" : true }, "expiration" : { "$gt" : 1659696977 }, "status" : { "$ne" : "inactive" }, "$where" : { "$code" : "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"true\" && !this.entities[i].isTypePattern && (this.entities[i].type == \"Room\" || this.entities[i].type == \"\" || !(\"type\" in this.entities[i])) && \"Room1\".match(this.entities[i].id)) {return true; }}return false; }" } }, { "entities.isPattern" : "false", "entities.isTypePattern" : true, "expiration" : { "$gt" : 1659696977 }, "status" : { "$ne" : "inactive" }, "$where" : { "$code" : "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"false\" && this.entities[i].isTypePattern && this.entities[i].id == \"Room1\" && \"Room\".match(this.entities[i].type)) {return true; }}return false; }" } }, { "entities.isPattern" : "true", "entities.isTypePattern" : true, "expiration" : { "$gt" : 1659696977 }, "status" : { "$ne" : "inactive" }, "$where" : { "$code" : "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"true\" && this.entities[i].isTypePattern && \"Room1\".match(this.entities[i].id) && \"Room\".match(this.entities[i].type)) {return true; }}return false; }" } } ], "servicePath" : { "$in" : [ "/", "/#" ] } }

After a JSON pretty print ;) looks this way:

{
	"$or": [{
		"entities.id": "Room1",
		"$or": [{
			"entities.type": "Room"
		}, {
			"entities.type": {
				"$exists": false
			}
		}],
		"entities.isPattern": "false",
		"entities.isTypePattern": {
			"$ne": true
		},
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		}
	}, {
		"entities.isPattern": "true",
		"entities.isTypePattern": {
			"$ne": true
		},
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		},
		"$where": {
			"$code": "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"true\" && !this.entities[i].isTypePattern && (this.entities[i].type == \"Room\" || this.entities[i].type == \"\" || !(\"type\" in this.entities[i])) && \"Room1\".match(this.entities[i].id)) {return true; }}return false; }"
		}
	}, {
		"entities.isPattern": "false",
		"entities.isTypePattern": true,
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		},
		"$where": {
			"$code": "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"false\" && this.entities[i].isTypePattern && this.entities[i].id == \"Room1\" && \"Room\".match(this.entities[i].type)) {return true; }}return false; }"
		}
	}, {
		"entities.isPattern": "true",
		"entities.isTypePattern": true,
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		},
		"$where": {
			"$code": "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"true\" && this.entities[i].isTypePattern && \"Room1\".match(this.entities[i].id) && \"Room\".match(this.entities[i].type)) {return true; }}return false; }"
		}
	}],
	"servicePath": {
		"$in": ["/", "/#"]
	}
}

@fgalan
Copy link
Member

fgalan commented Aug 5, 2022

Especifically regarding idTtypeNP we have:

DEBUG@2022-08-05T10:56:17.270Z  MongoCommonUpdate.cpp[1282]: idTtypeNP function: function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == "true" && !this.entities[i].isTypePattern && (this.entities[i].type == "Room" || this.entities[i].type == "" || !("type" in this.entities[i])) && "Room1".match(this.entities[i].id)) {return true; }}return false; }

@fgalan
Copy link
Member

fgalan commented Aug 5, 2022

What we want to do is replace $where with aggregation pipeline [https://www.mongodb.com/docs/manual/core/aggregation-pipeline/]

So effectively we would like to make $where an alias for aggregation pipeline, meaning whenever the user calls @where we end up calling command aggregate with appropriate arguments.

Not sure of fully understand what you mean by alias... in general in MongoDB, you cannot "blindly" replace usage of "$where in find()" by "$where in aggregation pipeline" as they are different operations (i.e. find() is a operation to query a database collection while aggregate() is a wrapper for a more complex command in MongoDB).

Having said that, note that "$where" is currently used in only one place in the Orion code: addTriggeredSubscriptions_noCache() and its sub-functions (i.e. fill_idNPtypeNP(), fill_idPtypeNP(), fill_idNPtypeP()andfill_idPtypeP()`)

Thus, under my understanding, I think it is just a matter of replace addTriggeredSubscriptions_noCache() by an equivalent function which uses the aggregation framework instead of find() with $where. In other words, to use orion::collectionAggregate() instead of orion::collectionQuery() in addTriggeredSubscriptions_noCache().

The structured of the current query has been posted in a previous comment. I hope it helps in the re-implementation of addTriggeredSubscriptions_noCache().

@anupamme
Copy link
Contributor Author

Hi @fgalan

Thanks for your detailed message. It helps clarify how we can re-implement addTriggeredSubscriptions_noCache(). I have a couple of follow up questions.

The way I understand is this that in its current implementation, it builds bgP->query by calling 4 sub-functions (i.e. fill_idNPtypeNP(), fill_idPtypeNP(), fill_idNPtypeP() and fill_idPtypeP()) and then uses this to call orion::collectionQuery .

Instead now we will have to build a pipeline just like it is built in mongoQueryTypes.cpp and then call orion::collectionAggregate with this pipeline object. Is my understanding correct?

My follow up question is that after using orion::collectionAggregate, how will the structure of the current query (JSON structure) change? e.g. this snippet

"$where": {"$code": "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"true\" && !this.entities[i].isTypePattern && (this.entities[i].type == \"Room\" || this.entities[i].type == \"\" || !(\"type\" in this.entities[i])) && \"Room1\".match(this.entities[i].id)) {return true; }}return false; }"}

  1. Now the key $where be replaced by what?
  2. The value part will be replaced by the contents of the pipeline we will construct, is that correct?

Also, how will the structure of the rest of the query (or json) will change?

I was looking for a couple of examples on how to construct the pipeline object (which can be passed as an argument to orion::collectionAggregate), are there any examples in the codebase?

@fgalan
Copy link
Member

fgalan commented Aug 11, 2022

Hi @fgalan

Thanks for your detailed message. It helps clarify how we can re-implement addTriggeredSubscriptions_noCache(). I have a couple of follow up questions.

The way I understand is this that in its current implementation, it builds bgP->query by calling 4 sub-functions (i.e. fill_idNPtypeNP(), fill_idPtypeNP(), fill_idNPtypeP() and fill_idPtypeP()) and then uses this to call orion::collectionQuery .

Instead now we will have to build a pipeline just like it is built in mongoQueryTypes.cpp and then call orion::collectionAggregate with this pipeline object. Is my understanding correct?

I think your understanding is correct.

My follow up question is that after using orion::collectionAggregate, how will the structure of the current query (JSON structure) change? e.g. this snippet

"$where": {"$code": "function(){for (var i=0; i < this.entities.length; i++) {if (this.entities[i].isPattern == \"true\" && !this.entities[i].isTypePattern && (this.entities[i].type == \"Room\" || this.entities[i].type == \"\" || !(\"type\" in this.entities[i])) && \"Room1\".match(this.entities[i].id)) {return true; }}return false; }"}

  1. Now the key $where be replaced by what?
  2. The value part will be replaced by the contents of the pipeline we will construct, is that correct?

Also, how will the structure of the rest of the query (or json) will change?

Not sure what you are asking here... :) Maybe you are asking for and explanation on what the function() in the $where clause does? The purpose of that function() is to to a "reverse regex" operation. That it, in the query we have the entity (id "Room1" and type "Room" in the example above) and we want to retrieve the documents in the csubs collection which match it.

This way is more readable:

function(){
    for (var i=0; i < this.entities.length; i++) {
	if (this.entities[i].isPattern == \"true\" && 
	    !this.entities[i].isTypePattern        && 
		(this.entities[i].type == \"Room\" || this.entities[i].type == \"\" || !(\"type\" in this.entities[i])) && 
		\"Room1\".match(this.entities[i].id)) {
	  return true; }
	}
	return false; 
  }

It works in the following way. this represents a document in the csubs collection (described here: https://fiware-orion.readthedocs.io/en/master/admin/database_model.html#csubs-collection)

  • A loop (for) iterates on the entities field. A positive match (return true) happens if at least one element in the array accomplish the following:
    • isPattern is true
    • it doesn't have a isTypePattern field (not sure why this is needed in this particular example, but probably the entities with isTypePattern are taken into account in other of the $where clauses of the complete query)
    • type is "Room" or the type is empty or element doesn't have type field (the second and third possibilities are "legacy" cases from NGSIv1, now in NGSIv2 all entities have a type)
    • id regex matches "Room1"

More on this approach to do "reverse regex" in this post at SOF

I was looking for a couple of examples on how to construct the pipeline object (which can be passed as an argument to orion::collectionAggregate), are there any examples in the codebase?

If you look for orion::collectionAggregate() in the code base, we can find 3 examples. The way in which the pipeline is build could be a bit "obscure" (due to the "nested append" approach) but you will find description comments with the pipeline structure. In particular:

@fgalan
Copy link
Member

fgalan commented Aug 11, 2022

Having a look to the cited post at SOF maybe a simpler solution to aggregation pipeline is possible :)

In particular, to follow this advice and use $expr with $regexMatch to implement the "reverse regex".

This example is closer to what we need: https://mongoplayground.net/p/ibWLonDkxFT

@fgalan
Copy link
Member

fgalan commented Aug 11, 2022

This example is closer to what we need: https://mongoplayground.net/p/ibWLonDkxFT

Trying to get even more closer, maybe there are some problems... see https://stackoverflow.com/questions/73317911/expr-with-regexmatch-doesnt-work-when-the-pattern-is-inside-an-array

@fgalan
Copy link
Member

fgalan commented Aug 11, 2022

This example is closer to what we need: https://mongoplayground.net/p/ibWLonDkxFT

Trying to get even more closer, maybe there are some problems... see https://stackoverflow.com/questions/73317911/expr-with-regexmatch-doesnt-work-when-the-pattern-is-inside-an-array

A solution to the problem was provided (https://stackoverflow.com/a/73318486/1485926):

db.collection.find({
  "$expr": {
    "$anyElementTrue": {
      "$map": {
        "input": "$patterns.pattern",
        "in": {
          "$regexMatch": {
            "input": "Room1",
            "regex": "$$this",
            "options": "i"
          }
        }
      }
    }
  }
})

Example: https://mongoplayground.net/p/2bb8aC45kJS

@anupamme
Copy link
Contributor Author

anupamme commented Aug 16, 2022

Hi @fgalan

Thanks for these pointers. So now what we'd be doing is replacing the current "reverse-regex" implementation which uses $where operator to $expr as you pointed out in your last comment.

In your earlier comment (#4148 (comment)) you mentioned the compiled query looks like this (after json pretty print)

{
	"$or": [{
		"entities.id": "Room1",
		"$or": [{
			"entities.type": "Room"
		}, {
			"entities.type": {
				"$exists": false
			}
		}],
		"entities.isPattern": "false",
		"entities.isTypePattern": {
			"$ne": true
		},
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		}
	}, {
		"entities.isPattern": "true",
		"entities.isTypePattern": {
			"$ne": true
		},
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		},
		"$expr": {
            "$anyElementTrue": {
              "$map": {
                "input": "",
                "in": {
                  "$regexMatch": {
                    "input": "",
                    "regex": "$$this",
                    "options": "i"
                  }
                }
              }
            }
          }
	}, {
		"entities.isPattern": "false",
		"entities.isTypePattern": true,
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		},
		"$expr": {
            "$anyElementTrue": {
              "$map": {
                "input": "",
                "in": {
                  "$regexMatch": {
                    "input": "",
                    "regex": "$$this",
                    "options": "i"
                  }
                }
              }
            }
          }
	}, {
		"entities.isPattern": "true",
		"entities.isTypePattern": true,
		"expiration": {
			"$gt": 1659696977
		},
		"status": {
			"$ne": "inactive"
		},
		"$expr": {
            "$anyElementTrue": {
              "$map": {
                "input": "",
                "in": {
                  "$regexMatch": {
                    "input": "",
                    "regex": "$$this",
                    "options": "i"
                  }
                }
              }
            }
          }
	}],
	"servicePath": {
		"$in": ["/", "/#"]
	}
}

Notice that I have replaced all the 3 occurrences of $where with $expr. The value of $expr is something we are working on currently so we will plug in those values when we are ready.

So, wanted to check is this JSON structure correct?

If yes, then follow up question is how do we replace the line (

bgP->boPNP.appendCode("$where", bgP->functionIdPtypeNP);
)

bgP->boPNP.appendCode("$where", bgP->functionIdPtypeNP);

We are not doing appendCode instead only an expression so should we do something like this:

bgP->boPNP.append("$expr", <reverse_regex_expression_json_object>);

where reverse_regex_expression_json_object is correct implementation which has structure like this:

"$anyElementTrue": {
              "$map": {
                "input": "",
                "in": {
                  "$regexMatch": {
                    "input": "",
                    "regex": "$$this",
                    "options": "i"
                  }
                }
              }
            }

Just wanted to make sure my current understanding is correct, so let me know your comments.

@fgalan
Copy link
Member

fgalan commented Aug 17, 2022

Notice that I have replaced all the 3 occurrences of $where with $expr. The value of $expr is something we are working on currently so we will plug in those values when we are ready.

So, wanted to check is this JSON structure correct?

The structure seems to be correct in the sense it replaces $where by $expr. I have noticed that input fields are empty string "" which wouldn't be correct, but I guess this is due you are still working on it.

To see if your implementation is correct, create a pull request with the change. We have a lot of regression tests for subscriptions in "noCache" way (when this functionality is used) so if your pull requests pass the tests that would be ok.

If yes, then follow up question is how do we replace the line (

bgP->boPNP.appendCode("$where", bgP->functionIdPtypeNP);

)

bgP->boPNP.appendCode("$where", bgP->functionIdPtypeNP);

We are not doing appendCode instead only an expression so should we do something like this:

bgP->boPNP.append("$expr", <reverse_regex_expression_json_object>);

where reverse_regex_expression_json_object is correct implementation which has structure like this:

"$anyElementTrue": {
              "$map": {
                "input": "",
                "in": {
                  "$regexMatch": {
                    "input": "",
                    "regex": "$$this",
                    "options": "i"
                  }
                }
              }
            }

Just wanted to make sure my current understanding is correct, so let me know your comments.

It makes sense to change appendCode() by just append() in this case, so I understand it's ok.

@anupamme
Copy link
Contributor Author

anupamme commented Sep 5, 2022

Hi @fgalan

We have written the expression for the 4 conditions in the current code and the new expression is in the playground: Playground Link.

I am pasting it here as well:

db.collection.find({
  "$expr": {
    "$anyElementTrue": {
      "$map": {
        "input": "$entities",
        "in": {
          $and: [
            {
              "$regexMatch": {
                "input": "Room1",
                "regex": "$$this.id",
                "options": "i"
              },
              
            },
            {
              "$eq": [
                "$$this.isPattern",
                "true"
              ]
            },
            {
              $or: [
                {
                  "$eq": [
                    "$$this.type",
                    "Room"
                  ],
                  
                },
                {
                  "$eq": [
                    "$$this.type",
                    ""
                  ]
                }
              ]
            },
            {
              $eq: [
                "$$this.isTypePattern",
                null
              ]
            }
          ]
        }
      }
    }
  }
})

There is still one condition not correct: it requires a check that isTypePattern field is not present. I couldn't find an operator to perform this check so I am currently checking if it is null, which of course is not the same.

I wanted to get feedback before I commit it and raise a PR. So kindly let me know.

@fgalan
Copy link
Member

fgalan commented Sep 5, 2022

There is still one condition not correct: it requires a check that isTypePattern field is not present. I couldn't find an operator to perform this check so I am currently checking if it is null, which of course is not the same.

Maybe the $exits operator could help?

@anupamme
Copy link
Contributor Author

anupamme commented Sep 6, 2022

Hi @fgalan , I played around with $exists operator, it works when it is part of boolean expression but when I embed it within "in" of $map then the compiler throws an error. Here is the link playground

So I'm not sure how to use $exists within $map. If you can suggest me how to go about doing it, that would be great.

@fgalan
Copy link
Member

fgalan commented Sep 6, 2022

Hi @fgalan , I played around with $exists operator, it works when it is part of boolean expression but when I embed it within "in" of $map then the compiler throws an error. Here is the link playground

So I'm not sure how to use $exists within $map. If you can suggest me how to go about doing it, that would be great.

I'd suggest to ask at StackOverflow using the "mongodb" and "mondob-query" labels, in the case it helps.

@anupamme
Copy link
Contributor Author

anupamme commented Sep 6, 2022

Done

@anupamme
Copy link
Contributor Author

anupamme commented Sep 7, 2022

Hey @fgalan

So someone responded at the Stackoverflow.

I will create a PR with this solution. If you have comments let me know.

@fgalan
Copy link
Member

fgalan commented Sep 7, 2022

I will create a PR with this solution. If you have comments let me know.

Great! I'll have a look to the PR and provide comments on it. Thanks!

@anupamme
Copy link
Contributor Author

Hi @fgalan

I created a pull request.

I have made the change only for function fill_idPtypeNP. Once it is approved I will make the similar changes for the other three functions:

fill_idNPtypeNP(), fill_idNPtypeP()and fill_idPtypeP()

Looking forward to your comments. Thanks!

@anupamme
Copy link
Contributor Author

I see there are three failing tests:

  1. on style issue
  2. mismatch in line count.

Can you give me some guidance on how to fix?

Also, is there a way I can run these tests locally and know the results?

@fgalan
Copy link
Member

fgalan commented Sep 14, 2022

With regars to style issue (https://github.com/telefonicaid/fiware-orion/actions/runs/3052031682/jobs/4921123995) I think this is the cause:

0002 errors of category 'Line ends in whitespace'
...
src/lib/mongoBackend/MongoCommonUpdate.cpp:1306:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]
src/lib/mongoBackend/MongoCommonUpdate.cpp:1312:  Line ends in whitespace.  Consider deleting these extra spaces.  [whitespace/end_of_line] [4]

With regards to functional test failing it's a bit weird... I could have expected that "no cache" test were failing (due to some problem with the new query) but the fail in "cache" tests is weird, as they are not using that part of the code at all.

The procedure to run tests locally is described in this section: https://fiware-orion.readthedocs.io/en/master/admin/build_source.html#testing-and-coverage (the make functional_test INSTALL_DIR=~ part, specially) and here https://github.com/telefonicaid/fiware-orion/tree/master/test/functionalTest.

I'll try to have a look myself but it could take some time, so maybe you prefer to do progress on your own...

@anupamme
Copy link
Contributor Author

Hi @fgalan

I tried installing functional Tests by going to the link. One of the steps is:

make install_scripts

However, there is no Makefile in the repository. Am I missing something here?

@fgalan
Copy link
Member

fgalan commented Sep 27, 2022

@fgalan
Copy link
Member

fgalan commented Sep 27, 2022

Maybe it is useful to have a look to CI Docker at https://github.com/telefonicaid/fiware-orion/tree/master/ci. This Docker container is built to run unit and functional test, so if you mimics the same steps in your environment you will end with a functional environment to run Orion tests.

anupamme added a commit to anupamme/fiware-orion that referenced this issue Oct 20, 2022
@fgalan fgalan added this to the 3.8.0 milestone Oct 20, 2022
@fgalan
Copy link
Member

fgalan commented Oct 21, 2022

Now that the PR is merged, the next question I have is when will this code go live?

This will be part of version 3.8.0, to be released soon. There is only one issue pending to freeze the release (this one: #4085) but it is a complex functionality, so it could take some time.

In the meanwhile, the :latest version in telefonicaiot dockerhub should provide that functionality. You can use it while 3.8.0 gets released.

@fgalan
Copy link
Member

fgalan commented Oct 24, 2022

PR #4226 with additional code comments and documentation fixes.

@fgalan fgalan closed this as completed Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants