MCPcopy
hub / github.com/dgraph-io/dgraph / waitUntilGraphqlHealthCheck

Method waitUntilGraphqlHealthCheck

dgraphtest/local_cluster.go:865–901  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

863}
864
865func (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
904func (c *LocalCluster) Upgrade(version string, strategy UpgradeStrategy) error {

Callers 1

containerHealthCheckMethod · 0.95

Calls 3

HTTPClientMethod · 0.95
LoginIntoNamespaceMethod · 0.80
DeleteUserMethod · 0.80

Tested by

no test coverage detected