@@ -24,44 +24,52 @@ import (
2424)
2525
2626func TestServiceHashWithAllValuesTheSame (t * testing.T ) {
27- hash1 , err := ServiceHash (projectConfig ( "a" , "b" , "c" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
27+ hash1 , err := ServiceHash (serviceConfig ("myContext1" , "always" , 1 ))
2828 assert .NilError (t , err )
29- hash2 , err := ServiceHash (projectConfig ( "a" , "b" , "c" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
29+ hash2 , err := ServiceHash (serviceConfig ("myContext1" , "always" , 1 ))
3030 assert .NilError (t , err )
3131 assert .Equal (t , hash1 , hash2 )
3232}
3333
3434func TestServiceHashWithIgnorableValues (t * testing.T ) {
35- hash1 , err := ServiceHash (& types. Project {}, serviceConfig ("myContext1" , "always" , 1 ))
35+ hash1 , err := ServiceHash (serviceConfig ("myContext1" , "always" , 1 ))
3636 assert .NilError (t , err )
37- hash2 , err := ServiceHash (& types. Project {}, serviceConfig ("myContext2" , "never" , 2 ))
37+ hash2 , err := ServiceHash (serviceConfig ("myContext2" , "never" , 2 ))
3838 assert .NilError (t , err )
3939 assert .Equal (t , hash1 , hash2 )
4040}
4141
42- func TestServiceHashWithChangedConfigContent (t * testing.T ) {
43- hash1 , err := ServiceHash (projectConfig ("myConfigSource" , "a" , "" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
42+ func TestServiceDependenciesHashWithoutChangesContent (t * testing.T ) {
43+ hash1 , err := ServiceDependenciesHash (projectConfig ("myConfigSource" , "a" , "" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
4444 assert .NilError (t , err )
45- hash2 , err := ServiceHash (projectConfig ("myConfigSource" , "b" , "" , "" ), serviceConfig ("myContext2" , "never" , 2 ))
45+ hash2 , err := ServiceDependenciesHash (projectConfig ("myConfigSource" , "a" , "" , "" ), serviceConfig ("myContext2" , "never" , 2 ))
46+ assert .NilError (t , err )
47+ assert .Assert (t , hash1 == hash2 )
48+ }
49+
50+ func TestServiceDependenciesHashWithChangedConfigContent (t * testing.T ) {
51+ hash1 , err := ServiceDependenciesHash (projectConfig ("myConfigSource" , "a" , "" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
52+ assert .NilError (t , err )
53+ hash2 , err := ServiceDependenciesHash (projectConfig ("myConfigSource" , "b" , "" , "" ), serviceConfig ("myContext2" , "never" , 2 ))
4654 assert .NilError (t , err )
4755 assert .Assert (t , hash1 != hash2 )
4856}
4957
50- func TestServiceHashWithChangedConfigEnvironment (t * testing.T ) {
51- hash1 , err := ServiceHash (projectConfig ("myConfigSource" , "" , "a" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
58+ func TestServiceDependenciesHashWithChangedConfigEnvironment (t * testing.T ) {
59+ hash1 , err := ServiceDependenciesHash (projectConfig ("myConfigSource" , "" , "a" , "" ), serviceConfig ("myContext1" , "always" , 1 ))
5260 assert .NilError (t , err )
53- hash2 , err := ServiceHash (projectConfig ("myConfigSource" , "" , "b" , "" ), serviceConfig ("myContext2" , "never" , 2 ))
61+ hash2 , err := ServiceDependenciesHash (projectConfig ("myConfigSource" , "" , "b" , "" ), serviceConfig ("myContext2" , "never" , 2 ))
5462 assert .NilError (t , err )
5563 assert .Assert (t , hash1 != hash2 )
5664}
5765
58- func TestServiceHashWithChangedConfigFile (t * testing.T ) {
59- hash1 , err := ServiceHash (
66+ func TestServiceDependenciesHashWithChangedConfigFile (t * testing.T ) {
67+ hash1 , err := ServiceDependenciesHash (
6068 projectConfig ("myConfigSource" , "" , "" , "./testdata/config1.txt" ),
6169 serviceConfig ("myContext1" , "always" , 1 ),
6270 )
6371 assert .NilError (t , err )
64- hash2 , err := ServiceHash (
72+ hash2 , err := ServiceDependenciesHash (
6573 projectConfig ("myConfigSource" , "" , "" , "./testdata/config2.txt" ),
6674 serviceConfig ("myContext2" , "never" , 2 ),
6775 )
0 commit comments