-
Notifications
You must be signed in to change notification settings - Fork 66
Issue 109: Adding support for deploy/clean triggers #577
Conversation
1. Copy deploy/sample/triggers-config.sample.xml to deploy/triggers-config.xml | ||
2. Edit deploy/triggers-config.xml to specify your trigger(s) | ||
3. Run 'ml <env> deploy triggers') | ||
ERR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice error handling..
Tidy work! Above a few inline comments.. |
By calling functions, mistakes in the configuration XML will trigger more specific errors.
The only outstanding comment is about self-testing. @grtjn, what do you say we merge this PR and then address testing separately? (Ideally it would all be together, but I'd like to get this integrated and move on.) |
Understood. Integrating this into self-test now makes it easier for all to test this, though. I only looked at the code so far, haven't ran it yet. I had a quick thought on this, and was thinking you might get away with it by adding to extra test steps to the bootstrap test case. Somewhere around here: https://github.com/marklogic/roxy/blob/master/deploy/test/test_server_config.rb#L101 Copy the trigger config into test/data/, point to it in the step, and run deploy_triggers. A quick count on trigger docs in the triggers db could verify success/fail. the second step would run clean_triggers, and the count should return zero. Nothing too fancy, just make sure the code runs without errors, and something gets created/cleaned.. Doable? |
Self-test doesn't run out of the box. I think some lookup fails if you don't run against a clustered environment. It is relatively easy to make it work though, just edit this line: https://github.com/marklogic/roxy/blob/dev/deploy/lib/xquery/setup.xqy#L1108 Replace You may also want to comment this line: https://github.com/marklogic/roxy/blob/dev/deploy/lib/xquery/setup.xqy#L5589 It produces a lot of unnecessary comments in the ErrorLog.. With these two changes the self-test on dev branch runs clean. The only odd thing is that the credentials test doesn't seem to work automatically anymore. I need to manually type bob/smith.. |
<trgr:depth>1</trgr:depth> | ||
</trgr:directory-scope> | ||
<trgr:document-content> | ||
<trgr:update-kind>modify</trgr:update-kind> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateTrigger but update-kind modify?
Okay, I added triggers to self-test. Doesn't do a whole lot of validation at this point, but it does run it, so big errors should get caught. |
@s.deploy_triggers.must_equal true | ||
@s.clean_triggers.must_equal true | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a triggers-config.xml, or is the self-test running with the sample one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ran for me because I already had a triggers-config file in deploy. Just revised so that it used the one in the sample directory for the test.
FYI, applied this for a project, deployment of triggers worked like a charm, thanks! Though, could you get rid of this xdmp:log statement: https://github.com/dmcassel/roxy/blob/issue-109/deploy/lib/xquery/setup.xqy#L5507. It's debug info.. |
…rs-config file to deploy directory
@grtjn have I addressed all your concerns? |
I only notice one more thing: You fixed the trigger config for ml7 self-test, but not for ml6, despite the fact you did enable triggers-db in ml6.. If you can attend to that, I'll try to run some elaborate self-tests tomorrow morning.. |
Oops, missed ml6. Just added that. |
@grtjn have you had a chance to run tests? |
Ran a self-test, but the deploy triggers is failing:
Weird though since properties and all are looking correct. Need to take a closer look later.. |
We decided to move selftest changes out of this PR. It is ready to go.. |
Added commands:
The code tests to make sure you have a Triggers database configured. The clean wipes out all triggers in the target database, so users are advised to have an application-specific triggers database. #109