#
# 25-June-2020
#
#-------------------------------------------------------------------------
#
# This file verifies that the sqlite3_bcv_destroy() function works under
# some circumstances at least. Specifically - with an Azure emulator.
#
# These tests are not run with real Azure, as it takes around 24 hours for
# a container to be properly deleted (i.e. so that its name can be reused).
#
source [file join [file dirname [info script]] test_common.tcl]
set testprefix util_destroy1
file delete -force test.db1
sqlite3 db test.db1
do_execsql_test 1.0 {
CREATE TABLE t1(x, y, z);
}
do_test 1.1 {
bcv_create_container $D(container2)
set bcv1 [bcv_open $D(container2)]
$bcv1 upload test.db1 t1.db
} {0}
do_test 1.2 {
set bcv2 [bcv_open -create 1 $D(container2)]
$bcv1 upload test.db1 t2.db
} {0}
do_test 1.3 {
$bcv2 destroy
} {0}
do_test 1.4 {
$bcv1 upload test.db1 t3.db
} {404}
do_test 1.5 {
$bcv1 errmsg
} {download manifest failed (404) - HTTP/1.1 404 The specified container does not exist.}
$bcv1 close
$bcv2 close
finish_test