|
| 1 | +/* jshint globalstrict:false, strict:false, maxlen: 200 */ |
| 2 | +/* global fail, assertEqual, assertTrue, arango */ |
| 3 | + |
| 4 | +// ////////////////////////////////////////////////////////////////////////////// |
| 5 | +// / DISCLAIMER |
| 6 | +// / |
| 7 | +// / Copyright 2018 ArangoDB GmbH, Cologne, Germany |
| 8 | +// / |
| 9 | +// / Licensed under the Apache License, Version 2.0 (the "License") |
| 10 | +// / you may not use this file except in compliance with the License. |
| 11 | +// / You may obtain a copy of the License at |
| 12 | +// / |
| 13 | +// / http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | +// / |
| 15 | +// / Unless required by applicable law or agreed to in writing, software |
| 16 | +// / distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | +// / WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | +// / See the License for the specific language governing permissions and |
| 19 | +// / limitations under the License. |
| 20 | +// / |
| 21 | +// / Copyright holder is triAGENS GmbH, Cologne, Germany |
| 22 | +// / |
| 23 | +// / @author Jan Steemann |
| 24 | +// ////////////////////////////////////////////////////////////////////////////// |
| 25 | + |
| 26 | +let jsunity = require('jsunity'); |
| 27 | + |
| 28 | +let canUseFailAt = function() { |
| 29 | + return arango.GET("/_admin/debug/failat") === true; |
| 30 | +}; |
| 31 | + |
| 32 | +function failAtApiSuite() { |
| 33 | + 'use strict'; |
| 34 | + return { |
| 35 | + setUp: function () { |
| 36 | + arango.DELETE("/_admin/debug/failat"); |
| 37 | + }, |
| 38 | + |
| 39 | + tearDown: function () { |
| 40 | + arango.DELETE("/_admin/debug/failat"); |
| 41 | + }, |
| 42 | + |
| 43 | + testCanUse: function () { |
| 44 | + let res = arango.GET("/_admin/debug/failat"); |
| 45 | + assertEqual(typeof res, "boolean"); |
| 46 | + assertTrue(res); |
| 47 | + }, |
| 48 | + |
| 49 | + testFailurePointsSet: function () { |
| 50 | + let res = arango.GET("/_admin/debug/failat/all"); |
| 51 | + assertEqual([], res); |
| 52 | + |
| 53 | + res = arango.PUT("/_admin/debug/failat/piff", {}); |
| 54 | + assertEqual(typeof res, "boolean"); |
| 55 | + assertTrue(res); |
| 56 | + res = arango.GET("/_admin/debug/failat/all"); |
| 57 | + assertEqual(["piff"], res); |
| 58 | + |
| 59 | + res = arango.PUT("/_admin/debug/failat/der-fuppes-wird-immer-schlimmer", {}); |
| 60 | + assertEqual(typeof res, "boolean"); |
| 61 | + assertTrue(res); |
| 62 | + res = arango.GET("/_admin/debug/failat/all"); |
| 63 | + assertEqual(["der-fuppes-wird-immer-schlimmer", "piff"], res); |
| 64 | + |
| 65 | + res = arango.DELETE("/_admin/debug/failat/piff"); |
| 66 | + assertEqual(typeof res, "boolean"); |
| 67 | + assertTrue(res); |
| 68 | + res = arango.GET("/_admin/debug/failat/all"); |
| 69 | + assertEqual(["der-fuppes-wird-immer-schlimmer"], res); |
| 70 | + |
| 71 | + res = arango.DELETE("/_admin/debug/failat"); |
| 72 | + assertEqual(typeof res, "boolean"); |
| 73 | + assertTrue(res); |
| 74 | + res = arango.GET("/_admin/debug/failat/all"); |
| 75 | + assertEqual([], res); |
| 76 | + |
| 77 | + res = arango.DELETE("/_admin/debug/failat/abc"); |
| 78 | + assertEqual(typeof res, "boolean"); |
| 79 | + assertTrue(res); |
| 80 | + res = arango.GET("/_admin/debug/failat/all"); |
| 81 | + assertEqual([], res); |
| 82 | + }, |
| 83 | + |
| 84 | + }; |
| 85 | +} |
| 86 | + |
| 87 | +if (canUseFailAt()) { |
| 88 | + jsunity.run(failAtApiSuite); |
| 89 | +} |
| 90 | +return jsunity.done(); |
0 commit comments