Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
dmapi / usr / lib / python2.7 / dist-packages / dmapi / tests / functional / wsgi / test_servers.pyc
Size: Mime:
ó
EV¥cc@sêddlZddlZddlmZddlmZddlmZ	ddl
mZddlm
ZddlmZddlmZdd	lmZdd
lmZdejejfd„ƒYZd
ejejfd„ƒYZdS(iÿÿÿÿN(tapi(tbase(tservers(ttest(tfixtures(tclient(tintegrated_helpers(tfake(tpolicy_fixturetServersPreSchedulingTestCasecBs˜eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d	„Zd
„Ze
jddejƒd
„ƒZd„Zd„ZRS(svTests for the servers API with unscheduled instances.

    With cellsv2 an instance is not written to an instance table in the cell
    database until it has been scheduled to a cell. This means we need to be
    careful to ensure the instance can still be represented before that point.

    NOTE(alaski): The above is the desired future state, this test class is
    here to confirm that the behavior does not change as the transition is
    made.

    This test class starts the wsgi stack for the nova api service, and uses
    an in memory database for persistence. It does not allow requests to get
    past scheduling.
    sv2.1cCs¿tt|ƒjƒtj|ƒ|jtjƒƒ|jtj	ƒƒ|jtj
|ƒƒ|jtjƒƒ|jtjddƒƒ}|j
|_
d|j
_|jtjdtƒƒdS(Ntapi_versionsv2.1tlatesttinstances_created(tsuperR	tsetUpt
fake_imagetstub_out_image_servicet
useFixtureRtRealPolicyFixturet
nova_fixturestNoopConductorFixturetNeutronFixturetPlacementFixturetOSAPIFixtureRtmicroversiontSingleCellSimpletFalse(tselftapi_fixture((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyR$s
cCs“|jtjƒƒtjƒ}iidd6|d6dd6dd6d6}|jjd	|ƒ}|jjd
|jddƒ}|jjd|ddƒ}|jd}|j	d|dƒ|j	||d
dƒ|j	|jdd|ddƒ|j	d|dƒ|j
|dƒ|j
|dƒ|j|dƒ|j	g|dƒ|j	d|dƒ|j	d|dƒ|j	d|dƒdS(NtfootnametimageReft1t	flavorReftnonetnetworkstserverRs
servers/%stids
flavors/%stimagetflavort
original_nametthostIdsOS-SRV-USG:launched_atsOS-SRV-USG:terminated_attlockedttagst
schedulingsOS-EXT-STS:task_statetbuildingsOS-EXT-STS:vm_statetBUILDtstatus(RRtAllServicesCurrentRtget_valid_image_idRtapi_posttapi_gettbodytassertEqualtassertIsNonetassertFalse(Rt	image_refR5tcreate_resptget_resptflavor_get_respR$((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyttest_instance_from_buildrequest3s4
cCs€tjƒ}iidd6|d6dd6dd6d6}|jjd	|ƒ}|jjd
|jddƒ}|jjd|ddƒ}|jd}|jd|dƒ|j||d
dƒ|j|jdd|ddƒ|jd|dƒ|j|dƒ|j|dƒ|j|dƒ|jg|dƒ|jd|dƒ|jd|dƒ|jd|dƒdS(NRRRR R!R"R#R$Rs
servers/%sR%s
flavors/%sR&R'R(R)R*sOS-SRV-USG:launched_atsOS-SRV-USG:terminated_atR+R,R-sOS-EXT-STS:task_stateR.sOS-EXT-STS:vm_stateR/R0(	RR2RR3R4R5R6R7R8(RR9R5R:R;R<R$((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt+test_instance_from_buildrequest_old_serviceSs2
cCsº|jtjƒƒtjƒ}iidd6|d6dd6dd6d6}|jjd	|ƒ}|jjd
|jddƒ|jj	d
|jdddt
ƒ}|jd
|jƒdS(NRRRR R!R"R#R$Rs
servers/%sR%tcheck_response_statusi”(
RRR1RR2RR3t
api_deleteR5R4RR6R0(RR9R5R:R;((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt&test_delete_instance_from_buildrequestqs	cCs§tjƒ}iidd6|d6dd6dd6d6}|jjd	|ƒ}|jjd
|jddƒ|jjd
|jdddtƒ}|jd
|j	ƒdS(NRRRR R!R"R#R$Rs
servers/%sR%R?i”(
RR2RR3R@R5R4RR6R0(RR9R5R:R;((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt2test_delete_instance_from_buildrequest_old_serviceƒs	cCs·tjƒ}iidd6|d6dd6dd6d6}|jjd	|ƒ}d
|dd<|jjd	|ƒ}|jjƒ}|jdt|ƒƒ|j|jdd|d
dƒ|jd
|d
dƒ|j|jdd|ddƒ|jd|ddƒ|jjdƒ}|jd	}|jdt|ƒƒ|j|jdd|d
dƒ|jd|d
dƒ|j|jdd|ddƒ|jd
|ddƒdS(NRRRR R!R"R#R$RtbariR%iis/servers/detail?sort_key=created_at&sort_dir=asc(	RR2RR3tget_serversR6tlenR5R4(RR9R5tinst1tinst2t	list_resp((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt&_test_instance_list_from_buildrequests”s0##		
##cCs!|jtjƒƒ|jƒdS(N(RRR1RI(R((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt%test_instance_list_from_buildrequests´scCs|jƒdS(N(RI(R((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt1test_instance_list_from_buildrequests_old_service¸scCse|jtjƒƒtjƒ}iidd6|d6dd6dd6dd	gd
6d6}|jjd|ƒ}d
|dd<d	dg|dd
<|jjd|ƒ}|jjdƒ}|jd}|j	dt
|ƒƒ|j	|jdd|ddƒ|j	d|ddƒ|jjdƒ}|jd}|j	dt
|ƒƒ|j	|jdd|ddƒ|j	d
|ddƒ|j	|jdd|ddƒ|j	d|ddƒ|jjdƒ}|jd}|j	dt
|ƒƒ|j	|jdd|ddƒ|j	d
|ddƒ|jjdƒ}|jd}|j	dt
|ƒƒdS(sãCreates two servers with two tags each, where the 2nd tag (tag2)
        is the only intersection between the tags in both servers. This is
        used to test the various tags filters working in the BuildRequestList.
        RRRR R!R"R#ttag1ttag2R,R$RRCttag3sservers/detail?tags=tag1,tag2iR%is!servers/detail?tags-any=tag1,tag3is!servers/detail?not-tags=tag1,tag2s%servers/detail?not-tags-any=tag1,tag3N(RRR1RR2RR3R4R5R6RE(RR9R5RFRGRH((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt/test_instance_list_from_buildrequests_with_tags»sJ		
#		
##		
#		
s2nova.objects.service.get_minimum_version_all_cellstreturn_valuecCs¶|jtj|ƒƒ}tjj}|jjiidd6dd6dd6idd6|d	6d
d6d
d6gd
6d6ƒ}|j||jƒ|jj|dƒ|j	||jƒdS(NR R!t,test_bfv_delete_build_request_pre_schedulingRR"R#it
boot_indextuuidtvolumetsource_typetdestination_typetblock_device_mapping_v2R$R%(
RRt
CinderFixturetIMAGE_BACKED_VOLRtpost_servertassertIntreserved_volumest
delete_servertassertNotIn(Rtmock_gettcindert	volume_idR$((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt2test_bfv_delete_build_request_pre_scheduling_ocatañscCsÙ|jtj|ƒƒ}|jtjƒƒtjj}|jjiidd6dd6dd6idd6|d	6d
d6d
d6gd
6d6ƒ}|j||j|dƒ|jj	|dƒ|j
||j|dƒdS(NR R!RQRR"R#iRRRSRTRURVRWR$R%(RRtCinderFixtureNewAttachFlowR1RYRRZR[tattachmentsR]R^(RR`RaR$((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyRQs"cCs›|jtjƒƒiidd6tjƒd6dd6dd6d6}|jj|ƒ}i|d	d
6dd6}|jjd
|ƒ}|jdt	|ƒƒdS(sCTests listing instances with a marker that is in the build_requests
        table and also filtering by ip, in which case the ip filter can't
        possibly find anything because instances that are not yet scheduled
        can't have ips, but the point is to find the marker in the build
        requests table.
        t1test_instance_list_build_request_marker_ip_filterRRR R!R"R#R$R%tmarkers192.168.159.150tiptsearch_optsiN(
RRR1RR2RRZRDR6RE(RR5R$RhR((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyRe9s

(t__name__t
__module__t__doc__tapi_major_versionRR=R>RARBRIRJRKROtmocktpatchtcompute_apitBFV_RESERVE_MIN_COMPUTE_VERSIONRbRQRe(((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyR	s		 				 			6"	%t,EnforceVolumeBackedForZeroDiskFlavorTestCasecBs)eZdZd„Zd„Zd„ZRS(sƒTests for the os_compute_api:servers:create:zero_disk_flavor policy rule

    These tests explicitly rely on microversion 2.1.
    cCsÓtt|ƒjƒtj|ƒ|jtjƒ|jtj	|ƒƒ|jt
jƒƒ|_
|jtjddƒƒ}|j
|_
|j|_iidd6dd6dd6d	d
6d6}|jj|ƒ|_dS(NR
sv2.1szero-disk-flavorRitramitvcpusitdiskR'(R
RqRRRt
addCleanuptFakeImageService_resetRRRRRRRt	admin_apitpost_flavortzero_disk_flavor(RRt
flavor_req((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyR^s 
cCs |jjitjtj6dtƒ|j|jdt	j
|jdƒ}|jt
j|jji|d6ƒ}|jdtj|ƒƒ|jd|jjƒdS(sÜTests that a non-admin trying to create an image-backed server
        using a flavor with 0 disk will result in a 403 error when rule
        os_compute_api:servers:create:zero_disk_flavor is set to admin-only.
        t	overwritet4test_create_image_backed_server_with_zero_disk_failsR%R$sBOnly volume-backed servers are allowed for flavors with zero disk.i“N(Rt	set_rulest
base_policiestRULE_ADMIN_APItservers_policiestZERO_DISK_FLAVORRt$_build_minimal_create_server_requestRRt#AUTO_DISK_CONFIG_ENABLED_IMAGE_UUIDRytassertRaisest
api_clienttOpenStackApiExceptionRZR[tsixt	text_typeR6tresponsetstatus_code(Rt
server_reqtex((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyR|us	cCsñ|jtjƒƒ|jtj|ƒƒ|jdƒ|jdƒ|j|jdd|jdƒ}|jddƒitjj
d6dd	6dd
6dd6g|d
<|jji|d6ƒ}|j
|j|dƒ}|jd|ddƒdS(stTests that creating a volume-backed server with a zero-root
        disk flavor will be allowed for admins.
        t	conductort	schedulert7test_create_volume_backed_server_with_zero_disk_allowedt	flavor_idR%RRSRTRURViRRRWR$tERRORs
No valid hosttfaulttmessageN(RRRRXt
start_serviceR‚RRytpoptNoneRYRwRZt_wait_for_state_changeR[(RR‹R$((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyRˆs"


(RiRjRkRR|R(((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyRqWs		(RmR‡tnova.computeRRot
nova.policiesRR~RR€tnovaRt
nova.testsRRtnova.tests.functional.apiRR…tnova.tests.functionalRtnova.tests.unit.imageRRtnova.tests.unitRtTestCasetInstanceHelperMixinR	Rq(((sL/usr/lib/python2.7/dist-packages/dmapi/tests/functional/wsgi/test_servers.pyt<module>s	ÿE