()
| 863 | } |
| 864 | |
| 865 | func (c *LocalCluster) waitUntilGraphqlHealthCheck() error { |
| 866 | hc, err := c.HTTPClient() |
| 867 | if err != nil { |
| 868 | return errors.Wrap(err, "error creating http client while graphql health check") |
| 869 | } |
| 870 | if c.conf.acl { |
| 871 | for attempt := range 10 { |
| 872 | if err = hc.LoginIntoNamespace(dgraphapi.DefaultUser, dgraphapi.DefaultPassword, x.RootNamespace); err == nil { |
| 873 | break |
| 874 | } |
| 875 | if attempt > 5 { |
| 876 | log.Printf("[WARNING] problem trying to login during graphql health check: %v", err) |
| 877 | } |
| 878 | time.Sleep(waitDurBeforeRetry) |
| 879 | } |
| 880 | if err != nil { |
| 881 | return errors.Wrap(err, "error during login while graphql health check") |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | for attempt := range 10 { |
| 886 | // Sleep for a second before retrying |
| 887 | time.Sleep(waitDurBeforeRetry) |
| 888 | // we do this because before v21, we used to propose the initial schema to the cluster. |
| 889 | // This results in schema being applied and indexes being built which could delay alpha |
| 890 | // starting to serve graphql schema. |
| 891 | err = hc.DeleteUser("nonexistent") |
| 892 | if err == nil { |
| 893 | log.Printf("[INFO] graphql health check succeeded for %v", c.conf.prefix) |
| 894 | return nil |
| 895 | } |
| 896 | if attempt > 5 { |
| 897 | log.Printf("[WARNING] problem during graphql health check: %v", err) |
| 898 | } |
| 899 | } |
| 900 | return errors.Wrap(err, "error during graphql health check") |
| 901 | } |
| 902 | |
| 903 | // Upgrades the cluster to the provided dgraph version |
| 904 | func (c *LocalCluster) Upgrade(version string, strategy UpgradeStrategy) error { |
no test coverage detected