mike-tr-adamson commented on code in PR #2673: URL: https://github.com/apache/cassandra/pull/2673#discussion_r1356796817
########## test/unit/org/apache/cassandra/inject/injections.md: ########## @@ -0,0 +1,356 @@ +<!--- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +## Injecting hooks dynamically in testing + +The testing infrastructure is equipped with Byteman, which allows to +inject hooks into the running code. In other words, at any point in +the test, you can tell the particular nodes, to do something at exact +location in the code - like you would set a conditional breakpoint +and when the debugger breaks, you can check something or perform some +additional actions. In short, it is particularly useful to: + +- synchronizing the test code and the nodes +- synchronizing the nodes between each other +- running actions step by step +- counting invocations +- tracing invocations +- force throwing exceptions +- and combinations of the above... + +Here you can find a short introduction and some examples how can it be +used. + +### Basics + +Byteman works on rules which are the units defining what, when, and +where should be invoked. That is, a single rule includes: the invoke +point, bindings, run condition and actions. + +**Invoke point** is a location in the code where the actions should +be hooked. Usually it is a class and method, but it can be specified +more precisely, like - entering method, exiting method, invoking some +method inside, particular line of code and so on. + +**Bindings** are just some constant definitions which can be used then +in run condition and actions. + +**Run condition** is a logical expression which determines whether +the rule should be invoked. + +**Actions** are the statements to be invoked. + +In DSE, we have `Rule` class which reflects a single Byteman rule. Review Comment: I have deleted that file because it is referencing an old version of the injections that isn't valid for the version being used. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

