-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Databases: Add OpenSearch index CRUD support (#1571)
* Upgrade GODO v1.121.0 * Update DOCTL to include opensearch index CRUD changes * Add more command details. * Add integration tests for opensearch index. --------- Co-authored-by: Rahul Bhardwaj <[email protected]>
- Loading branch information
1 parent
9282784
commit 18c4a81
Showing
20 changed files
with
604 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -262,6 +262,7 @@ func TestDatabasesCommand(t *testing.T) { | |
"sql-mode", | ||
"configuration", | ||
"topics", | ||
"indexes", | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package integration | ||
|
||
import ( | ||
"fmt" | ||
"net/http" | ||
"net/http/httptest" | ||
"net/http/httputil" | ||
"os/exec" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/sclevine/spec" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
var _ = suite("database/index/delete", func(t *testing.T, when spec.G, it spec.S) { | ||
var ( | ||
expect *require.Assertions | ||
server *httptest.Server | ||
) | ||
|
||
it.Before(func() { | ||
expect = require.New(t) | ||
|
||
server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { | ||
switch req.URL.Path { | ||
case "/v2/databases/some-database-id/indexes/some-index-id": | ||
auth := req.Header.Get("Authorization") | ||
if auth != "Bearer some-magic-token" { | ||
w.WriteHeader(http.StatusTeapot) | ||
} | ||
|
||
if req.Method != http.MethodDelete { | ||
w.WriteHeader(http.StatusMethodNotAllowed) | ||
return | ||
} | ||
|
||
w.WriteHeader(http.StatusNoContent) | ||
default: | ||
dump, err := httputil.DumpRequest(req, true) | ||
if err != nil { | ||
t.Fatal("failed to dump request") | ||
} | ||
|
||
t.Fatalf("received unknown request: %s", dump) | ||
} | ||
})) | ||
}) | ||
|
||
when("all required flags are passed", func() { | ||
it("deletes the database", func() { | ||
cmd := exec.Command(builtBinaryPath, | ||
"-t", "some-magic-token", | ||
"-u", server.URL, | ||
"database", | ||
"indexes", | ||
"delete", | ||
"some-database-id", | ||
"some-index-id", | ||
"-f", | ||
) | ||
|
||
output, err := cmd.CombinedOutput() | ||
expect.NoError(err, fmt.Sprintf("received error output: %s", output)) | ||
expect.Equal(strings.TrimSpace(""), strings.TrimSpace(string(output))) | ||
expect.Empty(output) | ||
}) | ||
}) | ||
}) |
Oops, something went wrong.