(t *testing.T)
| 880 | } |
| 881 | |
| 882 | func TestDrainingMode(t *testing.T) { |
| 883 | runRequests := func(expectErr bool) { |
| 884 | q1 := ` |
| 885 | { |
| 886 | alice(func: has(name)) { |
| 887 | name |
| 888 | } |
| 889 | } |
| 890 | ` |
| 891 | _, _, err := queryWithTs(queryInp{body: q1, typ: "application/dql"}) |
| 892 | if expectErr { |
| 893 | require.True(t, err != nil && strings.Contains(err.Error(), "the server is in draining mode")) |
| 894 | } else { |
| 895 | require.NoError(t, err, "Got error while running query: %v", err) |
| 896 | } |
| 897 | |
| 898 | m1 := ` |
| 899 | { |
| 900 | set { |
| 901 | _:alice <name> "Alice" . |
| 902 | } |
| 903 | } |
| 904 | ` |
| 905 | _, err = mutationWithTs(mutationInp{body: m1, typ: "application/rdf", commitNow: true, ts: ts}) |
| 906 | if expectErr { |
| 907 | require.True(t, err != nil && strings.Contains(err.Error(), "the server is in draining mode")) |
| 908 | } else { |
| 909 | require.NoError(t, err, "Got error while running mutation: %v", err) |
| 910 | } |
| 911 | |
| 912 | err = alterSchema(`name: string @index(term) .`) |
| 913 | if expectErr { |
| 914 | require.True(t, err != nil && strings.Contains(err.Error(), "the server is in draining mode")) |
| 915 | } else { |
| 916 | require.NoError(t, err, "Got error while running alter: %v", err) |
| 917 | } |
| 918 | |
| 919 | } |
| 920 | |
| 921 | require.NoError(t, hc.LoginIntoNamespace(dgraphapi.DefaultUser, dgraphapi.DefaultPassword, 0)) |
| 922 | |
| 923 | setDrainingMode(t, true, hc.AccessJwt) |
| 924 | runRequests(true) |
| 925 | |
| 926 | setDrainingMode(t, false, hc.AccessJwt) |
| 927 | runRequests(false) |
| 928 | } |
| 929 | |
| 930 | func TestOptionsForUiKeywords(t *testing.T) { |
| 931 | req, err := http.NewRequest(http.MethodOptions, fmt.Sprintf("%s/ui/keywords", addr), nil) |
nothing calls this directly
no test coverage detected