
    +                         S SK r S SKrS SKrS SKJr  \ R
                  R                  \ R
                  R                  \5      5      r " S S\R                  5      r
\S:X  a  \R                  " 5         gg)    N)testutilc                   ^   ^  \ rS rSrU 4S jrS rS rS rS rS r	S r
S	 rS
 rS rSrU =r$ )RuntimeTests   c                 @   > [         U l        [        [        U ]  5         g )N)RUNTIME_DEF_ROOTruntime_def_rootsuperr   setUp)self	__class__s    ,platform/ext-runtime/go/test/runtime_test.pyr   RuntimeTests.setUp   s     0lD')    c                     U R                  [        R                  R                  [        R                  R	                  U R
                  U5      5      5        g)z9Asserts that the relative path 'filename' does not exist.N)assertFalseospathexistsjoin	temp_path)r   filenames     r   assert_no_fileRuntimeTests.assert_no_file   s0    T^^X(NOPr   c                     U R                  SS5        U R                  U R                  5       5        U R                  [        R
                  " U R                  5      S/5        g )Nz	foo.notgopackage main
func main)
write_filer   generate_configsassertEqualr   listdirr   r   s    r   test_go_files_no_go RuntimeTests.test_go_files_no_go"   sG    %>?..01DNN3k]Cr   c                    U R                  SS5        U R                  5         [        U R                  S5      5       n[        R
                  " U5      nS S S 5        U R                  WSSS.5        U R                  S5        U R                  S5        U R                  S	S
9  U R                  SU R                  SS5      5        U R                  SU R                  SS5      5        g ! , (       d  f       N= f)Nfoo.gor   app.yamlgoflexruntimeenv
Dockerfile.dockerignoreTdeploydatadockerignore)
r   r   open	full_pathyamlloadr   r    assert_file_exists_with_contentsread_runtime_def_file)r   fcontentss      r   test_go_files_with_go"RuntimeTests.test_go_files_with_go'   s    ";<$..,-yy|H .%)&9	; 	L)O,T*--&&v|<	> 	--&&v?	A .-s   C''
C5c                    [         R                  " [         R                  R                  U R                  S5      5      nU R                  [         R                  R                  SS5      S5        U R                  SU R                  5       5        U R                  [         R                  R                  U R                  S5      5      5        g)z>Test go runtime does not recognize go files in subdirectories.subdirr%   r   Nr&   )r   mkdirr   r   r   r   r   r   r   r   r3   )r   subdir_paths     r   test_go_files_in_subdirs%RuntimeTests.test_go_files_in_subdirs9   s    hhrww||DNNHEFXx81	3t4467z(BCDr   c                    U R                  SS5        U R                  5         [        U R                  S5      5       n[        R
                  " U5      nSSS5        U R                  WSSS.5        U R                  S5        U R                  S	5        U R                  S
S9nU R                  USU R                  SS5      5        U R                  US	U R                  SS5      5        g! , (       d  f       N= f)z/Test generate_config_data with single .go file.r%   r   r&   Nr'   r(   r)   r,   r-   Tr.   r0   r1   )r   r   r2   r3   r4   r5   r   r   generate_config_data#assert_genfile_exists_with_contentsr7   )r   r8   r9   	cfg_filess       r   test_go_genfiles_with_go%RuntimeTests.test_go_genfiles_with_goA   s    ";<$..,-yy|H .%)&9	; 	L)O,--T-:	00&&v|<	> 	00&&v~>	@ .-s   C))
C7c                     U R                  SS5        U R                  SS9  U R                  SS5        U R                  SU R                  SS5      5        U R                  S	U R                  SS
5      5        g )Nr%   r   Tcustomr&   env: flex
runtime: go
r,   r0   r-   r1   )r   r   r6   r7   r!   s    r   test_go_custom_runtime#RuntimeTests.test_go_custom_runtimeV   s}    ";<T*--&	( 	--&&v|<	> 	--&&v~>	@r   c                     U R                  SS5        U R                  SS9nU R                  SS5        U R                  USU R	                  SS5      5        U R                  US	U R	                  SS
5      5        g)z.Test generate_config_data with custom runtime.r%   r   TrI   r&   rK   r,   r0   r-   r1   N)r   rC   r6   rD   r7   )r   rE   s     r   test_go_custom_runtime_no_write,RuntimeTests.test_go_custom_runtime_no_writec   s    ";<--T-:	--&	( 	00&&v|<	> 	00&&v?	Ar   c                     U R                  SS5        [        R                  " SSS9nU R                  U R	                  USS95        g )Nr%   r   r'      r)   Tappinfor/   r   r   AppInfoFake
assertTruer   r   configs     r   test_go_runtime_field"RuntimeTests.test_go_runtime_fields   sL    ";<%% 	--f59 . ; 	<r   c                     U R                  SS5        [        R                  " SSS9nU R                  U R	                  USS95        g )Nr%   r   rJ   rR   r)   TrS   rU   rX   s     r   test_go_custom_runtime_field)RuntimeTests.test_go_custom_runtime_field{   sL    ";<%% 	--f59 . ; 	<r   )r	   )__name__
__module____qualname____firstlineno__r   r   r"   r:   r@   rF   rL   rO   rZ   r]   __static_attributes____classcell__)r   s   @r   r   r      sA    *QD
A$E@*@A << <r   r   __main__)r   unittestr4   gae_ext_runtimer   r   dirname__file__r   TestBaser   r_   main r   r   <module>rm      s`    
   $77??277??8#<= i<8$$ i<X zMMO r   